And when you release that key, another event is being sent: pygame.KEYUP. It means when you press a key, an event is sent to this function, which type is pygame.KEYDOWN. () is a function that reports CURRENT EVENTS received from the user. Your problem is nothing related to Pygame. Player_changeable_name = pygame_textinput.TextInputVisualizer()ĭisplay_surface.blit(imposter, (ImpX, ImpY))ĭisplay_surface.blit(hero, (heroX,heroY))ĭisplay_surface.blit(sussie1, (Sussie1X,Sussie1Y))ĭisplay_surface.blit(sussie2, (Sussie2X,Sussie2Y))ĭisplay_surface.blit(sussie3, (Sussie3X,Sussie3Y))ĭisplay_surface.blit(sussie4, (Sussie4X,Sussie4Y)) I am very new to pygame and am making test projects to practice. I thought that this would work: if event.type = pygame.KEYDOWN:īut unfortunately, this is the same as removing the second line and fixing the code indentation. This won't be good in a runner game where the player chooses when to start running and when to stop. For example, while the down key is pressed down, the character will smoothly glide 5 steps down instead of jerking repeatedly. I achieved that task easily enough, but I was wondering is there a way to make movement continuous while a key is pressed. Well, that's great but now I want movement for a particular object. So I made a new game in pygame and after hours of debugging, I got to a stage where all of my objects get blitted onto the screen.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |