Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tphysics import *
- from random import randint
- game = Game("William's Game", 600, 600, "grey")
- player = Rectangle(-150, -150, 10, 10)
- player.fill_colour = "green"
- pickup = Rectangle( randint(-200,200), randint(-200,200), 10, 10)
- pickup.fill_colour = "turquoise"
- game.add_shape(player)
- game.add_shape(pickup)
- while True:
- if game.ispressed("Left"):
- player.x -= 0.7
- if game.ispressed("Right"):
- player.x += 0.7
- if game.ispressed("Up"):
- player.y += 0.7
- if game.ispressed("Down"):
- player.y -= 0.7
- if player.collide(pickup):
- player.width += 5
- player.height += 5
- pickup.x = randint(-200, 200)
- pickup.y = randint(-200, 200)
- game.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement