pygame-surface

How can I drag more than 2 images in PyGame?

牧云@^-^@ 提交于 2021-01-13 10:14:10
问题 i have this code but i wanna make this with other 4 images? import pygame from pygame.locals import * pygame.display.init() screen = pygame.display.set_mode((1143,677 )) img = pygame.image.load(r"C:\Users\ga-sa\Downloads\As.png") img1 = pygame.image.load(r"C:\Users\ga-sa\Downloads\03.png") imgPos = img.get_rect(topleft = (20, 20)) imgPos1 = img1.get_rect(topleft = (60, 20)) current_image = None LeftButton = 0 while 1: for e in pygame.event.get(): if e.type == QUIT: pygame.quit() exit(0) if e

How can I drag more than 2 images in PyGame?

你说的曾经没有我的故事 提交于 2021-01-13 10:13:34
问题 i have this code but i wanna make this with other 4 images? import pygame from pygame.locals import * pygame.display.init() screen = pygame.display.set_mode((1143,677 )) img = pygame.image.load(r"C:\Users\ga-sa\Downloads\As.png") img1 = pygame.image.load(r"C:\Users\ga-sa\Downloads\03.png") imgPos = img.get_rect(topleft = (20, 20)) imgPos1 = img1.get_rect(topleft = (60, 20)) current_image = None LeftButton = 0 while 1: for e in pygame.event.get(): if e.type == QUIT: pygame.quit() exit(0) if e

How can I drag more than 2 images in PyGame?

坚强是说给别人听的谎言 提交于 2021-01-13 10:13:34
问题 i have this code but i wanna make this with other 4 images? import pygame from pygame.locals import * pygame.display.init() screen = pygame.display.set_mode((1143,677 )) img = pygame.image.load(r"C:\Users\ga-sa\Downloads\As.png") img1 = pygame.image.load(r"C:\Users\ga-sa\Downloads\03.png") imgPos = img.get_rect(topleft = (20, 20)) imgPos1 = img1.get_rect(topleft = (60, 20)) current_image = None LeftButton = 0 while 1: for e in pygame.event.get(): if e.type == QUIT: pygame.quit() exit(0) if e

How do I make a sprite as a gif in pygame? [duplicate]

人盡茶涼 提交于 2021-01-13 09:45:08
问题 This question already has answers here : How can I load an animated GIF and get all of the individual frames in Pygame? (3 answers) Closed 3 months ago . So I have this idea for a game where you dodge projectiles while controlling a helicopter. I am wondering if you can make a sprite appear as a gif, or something along the lines of two images switching every fraction of a second. I know how to make a sprite appear as one image: self.surf = pygame.image.load("example.png").convert() But I was

How do I make a sprite as a gif in pygame? [duplicate]

懵懂的女人 提交于 2021-01-13 09:44:37
问题 This question already has answers here : How can I load an animated GIF and get all of the individual frames in Pygame? (3 answers) Closed 3 months ago . So I have this idea for a game where you dodge projectiles while controlling a helicopter. I am wondering if you can make a sprite appear as a gif, or something along the lines of two images switching every fraction of a second. I know how to make a sprite appear as one image: self.surf = pygame.image.load("example.png").convert() But I was

How do I make a sprite as a gif in pygame? [duplicate]

限于喜欢 提交于 2021-01-13 09:44:33
问题 This question already has answers here : How can I load an animated GIF and get all of the individual frames in Pygame? (3 answers) Closed 3 months ago . So I have this idea for a game where you dodge projectiles while controlling a helicopter. I am wondering if you can make a sprite appear as a gif, or something along the lines of two images switching every fraction of a second. I know how to make a sprite appear as one image: self.surf = pygame.image.load("example.png").convert() But I was

How do I scale a PyGame image (Surface) with respect to its center?

≯℡__Kan透↙ 提交于 2021-01-13 09:32:28
问题 I am fairly new to pygame and am working on my first game. (So sorry if I'm asking a stupid question) I am trying to get the title of the game to slowly increase and decrease in size like a sort of breathing effect in order to make the home screen more visually appealing. Here's what I've got to import the image: name = self.dir_path + "pixeltitle.png" self.pixeltitle = pg.image.load(name) self.pixeltitlerect = self.pixeltitle.get_rect() self.pixeltitlerect.center = (250,120) self.screen.blit

How can I add an image or icon to a button rectangle in Pygame?

五迷三道 提交于 2021-01-10 08:39:24
问题 I am a newbie to Pygame and I have created already the codes for my button but I still have a problem because I don't know how will I put an image instead of the solid color red in a rectangle. Here is my codes, hope you can help! def button(x, y, w, h, ic, ac, action=None): mouse = pygame.mouse.get_pos() click = pygame.mouse.get_pressed() if x + w > mouse[0] > x and y + h > mouse[1] > y: pygame.draw.rect(screen, ac, (x, y, w, h)) if click[0] == 1 and action!= None: if action == "continue":

How do I add a rubber band for mouse dragging in PyGame? [closed]

五迷三道 提交于 2020-12-26 16:36:34
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month . Improve this question I made the second code separate from the first and I wanted to implement the same functionality as the second which is to draw a line with the mouse I made the second code separate from the first and I wanted to implement the same functionality of the second which is to draw a

How do I add a rubber band for mouse dragging in PyGame? [closed]

喜夏-厌秋 提交于 2020-12-26 16:28:25
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month . Improve this question I made the second code separate from the first and I wanted to implement the same functionality as the second which is to draw a line with the mouse I made the second code separate from the first and I wanted to implement the same functionality of the second which is to draw a