|
BRAHBRAHBRAH.py
import pyxel
from time import sleep
from random import randint
class App:
def __init__(self) :
pyxel.init(128, 128, title="NdC 2024")
self.x = 0
self.y = 12*8
self.n = 1
self.saut = True
self.d = 1
self.piece = True
self.vitesse = 1
self.boule = 0
self.lvl = 0
self.alea = randint(8*2,12*8)
pyxel.load("2.pyxres")
pyxel.run(self.update, self.draw)
def debut(self):
pyxel.cls(0)
self.x = 0
self.y = 12*8
self.n = 1
self.saut = True
self.d = 1
self.piece = True
self.vitesse = 1
self.alea = randint(8*2,12*8)
def perdu(self):
pyxel.cls(0)
self.lvl = 7
self.draw()
pyxel.flip()
sleep(4)
self.debut()
self.lvl = 0
def plus_lvl(self) :
pyxel.cls(0)
self.lvl +=1
self.debut()
def update(self):
if (pyxel.pget(self.x+8, self.y + 16 ) == 11 or pyxel.pget(self.x+8, self.y + 16 ) == 4 or pyxel.pget(self.x+8, self.y + 16 ) == 0 )and self.vitesse > 0 :
self.saut = True
self.vitesse = 0
self.vitesse -= 0.2
else :
self.vitesse += 0.2
self.y += self.vitesse
if pyxel.btn(pyxel.KEY_TAB):
pyxel.quit()
if pyxel.btn(pyxel.KEY_RIGHT) :
self.x = (self.x +1.5) % pyxel.width
self.n = (((pyxel.frame_count//2)%4))*16
self.d = 1
if pyxel.btn(pyxel.KEY_LEFT) and self.x >1:
self.x = (self.x -1.5) % pyxel.width
self.n = (((pyxel.frame_count//2)%4))*16
self.d = -1
if pyxel.btn(pyxel.KEY_UP) and self.saut :
self.vitesse = -2.8
self.saut = False
if (self.x-105 > -8 and self.y-12*8 > -7) :
self.piece = False
self.plus_lvl()
if self.y > 14*8 or pyxel.pget(self.x+8, self.y + 16 ) == 8 or pyxel.pget(self.x+8, self.y + 16 ) == 15 :
self.perdu()
self.boule = (self.boule +2) % pyxel.width
if abs(self.vitesse) > 0.2 :
self.n = 0
def draw(self):
pyxel.cls(0)
img = pyxel.images[0]
for x in range(15):
for y in range(15):
position = pyxel.tilemaps[self.lvl].pget(x,y)
pyxel.blt(x*8,y*8,img,position[0]*8,position[1]*8,15*8,15*8)
pyxel.blt(self.x, self.y, pyxel.images[0], self.n, 16, 16*self.d, 16, 2)
pyxel.blt(self.alea, self.boule, pyxel.images[0], (((pyxel.frame_count//5)%3)+6)*16, 16*5, 16, 16, 2, 90)
if self.piece :
pyxel.blt(13*8,12*8 , pyxel.images[0], (((pyxel.frame_count//5)%3)+2)*16, 16*3, 16, 16, 2)
App()
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 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
|