Play game
Killer Square's itch.io pageHow many characters of code did you use?
496
Include your code here, if you'd like to show it off!
from pygame import *
init()
y=(255,255,0)
j=display.set_mode((500,500))
c=time.Clock()
s=Surface((25,25))
s.fill(y)
l=s
p=s.get_rect()
x,y=0,0
while True:
q=mouse.get_pos()
j.fill((0,0,0))
j.blit(s,(p))
m=Vector2(q)-p.center
if q != (0,0):
n=m.normalize()
p=p.move(n[0]*20,n[1]*20)
if p.collidepoint(q):
quit()
for e in event.get():
if e.type==QUIT:
quit()
c.tick(20)
display.flip()
Leave a comment
Log in with itch.io to leave a comment.