add new codes
This commit is contained in:
BIN
images/apple.png
Normal file
BIN
images/apple.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
25
main.py
25
main.py
@@ -1,20 +1,23 @@
|
|||||||
import pgzrun
|
import pgzrun
|
||||||
|
import random
|
||||||
|
|
||||||
WIDTH = 800
|
WIDTH = 800
|
||||||
HEIGHT = 600
|
HEIGHT = 600
|
||||||
|
|
||||||
ship = Actor('dead8')
|
apple = Actor("apple")
|
||||||
ship.x = 370
|
apple_x = WIDTH / 2
|
||||||
ship.y = 550
|
apple_y = HEIGHT / 2
|
||||||
|
apple.pos = (WIDTH / 2 , HEIGHT / 2)
|
||||||
|
|
||||||
def update():
|
sword = Actor("sword")
|
||||||
if keyboard.left:
|
|
||||||
ship.x = ship.x - 5
|
dinosuars = []
|
||||||
if keyboard.right:
|
corpses = []
|
||||||
ship.x = ship.x + 5
|
|
||||||
|
|
||||||
def draw():
|
def draw():
|
||||||
screen.fill((80,0,70))
|
screen.fill((100,220,100))
|
||||||
ship.draw()
|
apple.draw()
|
||||||
|
|
||||||
|
|
||||||
pgzrun.go() # Must be last line
|
|
||||||
|
pgzrun.go()
|
||||||
20
old_code/main1.py
Normal file
20
old_code/main1.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import pgzrun
|
||||||
|
|
||||||
|
WIDTH = 800
|
||||||
|
HEIGHT = 600
|
||||||
|
|
||||||
|
ship = Actor('dead8')
|
||||||
|
ship.x = 370
|
||||||
|
ship.y = 550
|
||||||
|
|
||||||
|
def update():
|
||||||
|
if keyboard.left:
|
||||||
|
ship.x = ship.x - 5
|
||||||
|
if keyboard.right:
|
||||||
|
ship.x = ship.x + 5
|
||||||
|
|
||||||
|
def draw():
|
||||||
|
screen.fill((80,0,70))
|
||||||
|
ship.draw()
|
||||||
|
|
||||||
|
pgzrun.go() # Must be last line
|
||||||
Reference in New Issue
Block a user