+ 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)

24th May 2020, 2:54 AM
Allamprabhu Hiremath
4 Antworten
+ 2
If you want to move the player using keys on keyboard then you can use https://code.sololearn.com/c58D2wQOANhE/?ref=app
28th May 2020, 5:12 AM
Gaurav Kulkarni
Gaurav Kulkarni - avatar
+ 1
You mean you want to the player in the game you created
28th May 2020, 5:02 AM
Gaurav Kulkarni
Gaurav Kulkarni - avatar
+ 1
I have te same problem
20th Nov 2020, 5:30 PM
Juka Juka
Juka Juka - avatar
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
29th Dec 2020, 2:15 AM
Kon