|
app.py
# Pyxel Studio
#version final
import pyxel
class NivGryfon:
def __init__(self):
self.harry_x = 82
self.harry_y = 35
pyxel.run(self.update, self.draw)
pyxel.load("res.pyxres")
def draw(self):
"""création et positionnement des objets (30 fois par seconde)"""
pyxel.cls(2)
#pyxel.bltm(0,0,0,0,0,256,128)
def update(self):
pass
# position initiale de Harry:
def saut(self, harry_y):
if pyxel.btn(pyxel.KEY_UP):
if (harry_y > 0) :
harry_y = harry_y - 1
return harry_y
class Jeu:
def __init__(self):
pyxel.init(256, 128, title="Choisir perso")
niveau_courant = NiveauSel
pyxel.load("Persos.pyxres")
pyxel.run(self.draw, self.update)
def update(self):
#niveau_courant=self.NiveauSe1.choisir()
pass
def draw(self):
self.niveau_courant.draw()
def choisir(self):
if pyxel.btn(pyxel.MOUSE_BUTTON_LEFT) and pyxel.mouse_x<97 and pyxel.mouse_x>82 and pyxel.mouse_y<60 and pyxel.mouse_y>35:
niveau_courant =NivGryfon
niveau_courant =NiveauSel
class NiveauSel:
def __init__(self, Jeu):
pyxel.mouse(True)
self.harry_x = 82
self.harry_y = 35
self.draco_x = 150
self.draco_y = 85
self.luna_x = 82
self.luna_y = 84
self.tonks_x = 150
self.tonks_y = 35
pyxel.run(self.update, self.draw)
def draw(self):
"""création et positionnement des objets (30 fois par seconde)"""
pyxel.cls(7)
pyxel.blt(self.harry_x,self.harry_y,0,0,0,15,25)
pyxel.blt(self.luna_x, self.luna_y, 0, 15, 0,17,30)
pyxel.blt(self.draco_x, self.draco_y, 0, 32, 0,17,25)
pyxel.blt(self.tonks_x, self.tonks_y, 0, 48,0,15,25)
pyxel.rect(82, 35, 1, 1, 1)
pyxel.rect(97, 35, 1, 1, 1)
pyxel.rect(82, 60, 1, 1, 1)
pyxel.rect(97, 60, 1, 1, 1)
def update(self):
# self.choisir()
pass
#ef choisir(self):
#if pyxel.btn(pyxel.MOUSE_BUTTON_LEFT) and pyxel.mouse_x<97 and pyxel.mouse_x>82 and pyxel.mouse_y<60 and pyxel.mouse_y>35:
# return NivGryfon
# return NiveauSel
Jeu()
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
|