Add files via upload
This commit is contained in:
parent
d6915bc901
commit
741ea4081f
3 changed files with 29 additions and 18 deletions
|
@ -15,10 +15,6 @@ while run: # Creating loop
|
|||
run = False # Break loop
|
||||
win.fill((255,255,255)) # Fill window with color
|
||||
|
||||
playerRect = pygwin.rect(player[0]-10,player[1]-10,20,20) # Player rect
|
||||
win.draw.rect((0,0,0),playerRect) # Drawing player rect
|
||||
win.draw.rect((200,50,50),apple) # Drawing apple rect
|
||||
|
||||
win.blit(score,(0,0)) # Writing player score
|
||||
|
||||
if pygwin.keyboard.isPressed('w'): # If keyboard key w pressed
|
||||
|
@ -39,6 +35,10 @@ while run: # Creating loop
|
|||
if player[1] > 510: # If player out of the screen (down)
|
||||
player[1] = -10 # Set player position in up
|
||||
|
||||
playerRect = pygwin.rect(player[0]-10,player[1]-10,20,20) # Player rect
|
||||
win.draw.rect((0,0,0),playerRect) # Drawing player rect
|
||||
win.draw.rect((200,50,50),apple) # Drawing apple rect
|
||||
|
||||
if playerRect.collide(apple): # If player rect collide apple rect
|
||||
apple = pygwin.rect(random.randint(0,490),
|
||||
random.randint(0,490),20,20) # Change apple rect
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue