Commit be49fe40 by BellCodeEditor

auto save

parent 8e3eb3a0
Showing with 24 additions and 10 deletions
import pygame
cacti=pygame.image.load('cacti.pang')
rect = cacti.get_rect()
print(rect)
print(rect.x)
print(rect.y)
print(rect.width)
print(rect.height)
import pygame
from pygame import locals
pygame.init()
screen = pygame.display.set_mode((1000,600))
FPS = =pygame.time.Clock()
pygame.display.set_caption("大头")
index = 0 index = 0
jumpState = "runing" jumpState = "runing"
y = 400 y = 400
...@@ -21,3 +30,18 @@ while True: ...@@ -21,3 +30,18 @@ while True:
y += 5 y += 5
else: else:
jumpState = "runing" jumpState = "runing"
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if event.type == locals.KEYDOWN:
if jumpState == "runing"
if event.key == locals.K_SPACE:
jumpState = "up"
if jumpState == "up":
if t > 0:
y -= t
t -= 2
eise:
jumpState = "down"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment