+ 2
I want to learn pygame to build a simple game using pydroid.But I stuck in a problem how to move an object by touching a screen?
import pygame_sdl2 as pygame pygame.init() screen= pygame.display.set_mode((800,600),0,32) pygame.display.set_caption("hello") icon = pygame.image.load("ufo.png") pygame.display.set_icon(icon) playerimg =pygame.image.load("ufo.png") playerX = 470 playerY = 1380 def player(x,y): screen.blit(playerimg,(x,y)) pygame.display.update() while True: screen.fill((0,0,0)) for event in pygame.event.get(): if event.type==pygame.QUIT: running = False player (playerX,playerY) pygame.display.update() player(x,y)
4 Answers
+ 2
If you want to move the player using keys on keyboard then you can use
https://code.sololearn.com/c58D2wQOANhE/?ref=app
+ 1
You mean you want to the player in the game you created
+ 1
I have te same problem
0
Me too, can someone please help me out. I'm new in coding and I'm learning using my phone but I can't figure out how to create keys on the screen of the phone