pygame-surface

How do I rotate a sprite towards the mouse and move it?

浪尽此生 提交于 2020-12-11 06:28:48
问题 I'm confused by the fact that in my code the sprite's coordinates don't seem to change where it is. Putting (200, 200) would be the same as putting (900, 100000). So basically i cannot coordinate the sprite in a designated position. Can you help? Turning credits to Ann Zen But the sprite problems on me Pygame sprite not turning accordingly to mouse My code: import pygame from math import atan2, degrees # tank = pygame.image.load('Sprite0.png') wn = pygame.display.set_mode((400, 400)) class

How do I rotate a sprite towards the mouse and move it?

那年仲夏 提交于 2020-12-11 06:22:29
问题 I'm confused by the fact that in my code the sprite's coordinates don't seem to change where it is. Putting (200, 200) would be the same as putting (900, 100000). So basically i cannot coordinate the sprite in a designated position. Can you help? Turning credits to Ann Zen But the sprite problems on me Pygame sprite not turning accordingly to mouse My code: import pygame from math import atan2, degrees # tank = pygame.image.load('Sprite0.png') wn = pygame.display.set_mode((400, 400)) class

How to fix this DeprecationWarning

丶灬走出姿态 提交于 2020-11-29 09:12:25
问题 DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. win.blit(playerStand, (x, y)) DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. win.blit(walkLeft[animCount // 5], (x, y)) 回答1: The warning is related to the coordinate parameter of blit(). Floating point