|
|
|
app.py
import pyxel
pyxel.init(128, 128, title=" Nuit du Code")
pyxel.load('U3.pyxres')
vaisseau_y = 85
vaisseau_x = 5
plateforme_x = 0
plateforme_y = 100
mur1_x = 80
mur1_y = 82
mur2_x = 60
mur2_y = 91
pique1_x=40
pique1_y=97
def vaisseau_deplacement(x, y):
# L'objet peut descendre automatiquement ?
if pyxel.pget(x, y + 8) == 0 and pyxel.pget(x + 7, y + 8) == 0:
y = y + 3
# L'objet peut aller à droite ?
if pyxel.btn(pyxel.KEY_RIGHT):
if (x < 120) :
x = x + 1
if pyxel.pget(x + 8, y) != 0 and pyxel.pget(x + 8, y + 7) == 0:
x = x - 1
if pyxel.btn(pyxel.KEY_LEFT):
if (x > 0) :
x = x - 1
if pyxel.pget(x + 8, y) != 0 and pyxel.pget(x + 8, y + 7) == 0:
x=x-1
if pyxel.btn(pyxel.KEY_UP):
if (y > 0) :
y = y -5
return x, y
def update():
global vaisseau_x, vaisseau_y
vaisseau_x, vaisseau_y = vaisseau_deplacement(vaisseau_x, vaisseau_y)
def draw():
pyxel.cls(0)
#pyxel.rect(vaisseau_x,vaisseau_y,8,8,8)
pyxel.blt(vaisseau_x, vaisseau_y, 0, 16, 112, 16, 16, 12)
pyxel.rect(plateforme_x,plateforme_y, 128, 32, 10)
pyxel.rect(mur1_x, mur1_y, 10,15,15)
pyxel.rect(mur2_x, mur2_y, 10,5,15)
pyxel.rect(pique1_x, pique1_y, 15,3,12)
pyxel.run(update, draw) Create an account to manage your projects and publish them on the playground.
Layout
Packages
If your project uses packages, list them bellow (names separated by commas). Packages that can be added are only packages built in Pyodide.
Example: numpy,pandas Project Name
Documentation
LICENSE
Choose a license:
Public link
Share this link so people can discover your project / game.
Public link: www.pyxelstudio.net/w4xjzfml
File to execute with the public link
PYXEL DOCUMENTATION
|