pygame

Icons are not displayed properly with pygame

落花浮王杯 提交于 2021-01-30 02:42:09
问题 The icon is not displayed, it's only displayed after closing for half a second: screen = pygame.display.set_mode((1600, 900)) pygame.display.set_caption(‘Elizabeth2’) icon = pygame.image.load('reindeer.png') pygame.display.set_icon(icon) 回答1: See pygame.display.set_icon(): [...] Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set. Set the icon before pygame

Icons are not displayed properly with pygame

青春壹個敷衍的年華 提交于 2021-01-30 02:40:29
问题 The icon is not displayed, it's only displayed after closing for half a second: screen = pygame.display.set_mode((1600, 900)) pygame.display.set_caption(‘Elizabeth2’) icon = pygame.image.load('reindeer.png') pygame.display.set_icon(icon) 回答1: See pygame.display.set_icon(): [...] Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set. Set the icon before pygame

Icons are not displayed properly with pygame

妖精的绣舞 提交于 2021-01-30 02:36:42
问题 The icon is not displayed, it's only displayed after closing for half a second: screen = pygame.display.set_mode((1600, 900)) pygame.display.set_caption(‘Elizabeth2’) icon = pygame.image.load('reindeer.png') pygame.display.set_icon(icon) 回答1: See pygame.display.set_icon(): [...] Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set. Set the icon before pygame

Pygame and Numpy Animations

不羁岁月 提交于 2021-01-30 02:36:25
问题 Suppose I have a Numpy array myAnimation of datatype np.uint8 representing an animation (multiple frames of still 8-bit RGBA images) of shape (y,x,4,k) where y is the height, x is the width, 4 is the number of channels (red, green, blue, alpha), and the k is the number of frames in the animation. Suppose I would like to play back the frames of this NumPy array in PyGame at a specified frame rate (say, 15 frames per second) and have the animation loop. Is this possible to do with Pygame? If so

python, pygame - jumping too fast?

只谈情不闲聊 提交于 2021-01-30 02:34:15
问题 I am messing around with pygame, and trying to create a simple jumping function (no physics yet). For some reason my "jumps" are not visible in the display, even though the values I am using print out and seem to be working as intended. What could I be doing wrong? isJump = False jumpCount = 10 fallCount = 10 if keys[pygame.K_SPACE]: isJump = True if isJump: while jumpCount > 0: y -= (jumpCount**1.5) / 3 jumpCount -= 1 print(jumpCount) while fallCount > 0: y += (fallCount**1.5) / 3 fallCount

python, pygame - jumping too fast?

半世苍凉 提交于 2021-01-30 02:34:00
问题 I am messing around with pygame, and trying to create a simple jumping function (no physics yet). For some reason my "jumps" are not visible in the display, even though the values I am using print out and seem to be working as intended. What could I be doing wrong? isJump = False jumpCount = 10 fallCount = 10 if keys[pygame.K_SPACE]: isJump = True if isJump: while jumpCount > 0: y -= (jumpCount**1.5) / 3 jumpCount -= 1 print(jumpCount) while fallCount > 0: y += (fallCount**1.5) / 3 fallCount

Pygame Bouncy Ball Sinks Through Floor

走远了吗. 提交于 2021-01-30 02:33:29
问题 The code below bounces a ball but for some reason the ball goes through the ground after it finishes its bounces. Anyone Know Why? The idea of the code is a ball starts at the top left corner and then falls and bounces and then goes up and back down and so on until it stops bouncing, but when it stops bouncing it starts jittering and slowly sinks through the ground. Idk why and I cant figure it out. Anyone know why? Thanks for the help import pygame pygame.init() #All keyboard and mouse input

Pygame Bouncy Ball Sinks Through Floor

試著忘記壹切 提交于 2021-01-30 02:33:07
问题 The code below bounces a ball but for some reason the ball goes through the ground after it finishes its bounces. Anyone Know Why? The idea of the code is a ball starts at the top left corner and then falls and bounces and then goes up and back down and so on until it stops bouncing, but when it stops bouncing it starts jittering and slowly sinks through the ground. Idk why and I cant figure it out. Anyone know why? Thanks for the help import pygame pygame.init() #All keyboard and mouse input

Pygame and Numpy Animations

狂风中的少年 提交于 2021-01-30 02:32:33
问题 Suppose I have a Numpy array myAnimation of datatype np.uint8 representing an animation (multiple frames of still 8-bit RGBA images) of shape (y,x,4,k) where y is the height, x is the width, 4 is the number of channels (red, green, blue, alpha), and the k is the number of frames in the animation. Suppose I would like to play back the frames of this NumPy array in PyGame at a specified frame rate (say, 15 frames per second) and have the animation loop. Is this possible to do with Pygame? If so

Pygame Bouncy Ball Sinks Through Floor

岁酱吖の 提交于 2021-01-30 02:30:19
问题 The code below bounces a ball but for some reason the ball goes through the ground after it finishes its bounces. Anyone Know Why? The idea of the code is a ball starts at the top left corner and then falls and bounces and then goes up and back down and so on until it stops bouncing, but when it stops bouncing it starts jittering and slowly sinks through the ground. Idk why and I cant figure it out. Anyone know why? Thanks for the help import pygame pygame.init() #All keyboard and mouse input