whoa-c-est-dure (Carnot 2026, Premiere)
Pokémon de chez wish / Tower defense
Le seul truc qui marche c'est les pokémon, clic passe sur la toure, clic gauche pour le ramener dans l'inventaire.
La musique est insane btw
Code Python
import pyxel
pyxel.init(128, 128, fps = 30, title="Nuit du Code")
pyxel.load("theme.pyxres")
pyxel.mouse(True)
w = True
perso = True
perso_select_p = False
perso_select_d = False
x = 0
y = 0
tx1 = 40
ty1 = 16
tx2 = 40
ty2 = 40
dx = 0
dy = 8
x1 = 64
y1 = 0
pv = 100
gameover = False
def update():
global x, y, dx, dy, y1,tx1, ty1, tx2, ty2, perso, perso_select_p, perso_select_d, pv, gameover
if pyxel.frame_count == 0:
pyxel.playm(0, loop=True)
##Select pika
if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and x <= pyxel.mouse_x < x + 8 and y <= pyxel.mouse_y < y + 8:
if perso_select_p == False:
x = x + 4
perso_select_p = True
else :
x = x - 4
perso_select_p = False
##Select toure
if perso_select_p == True and tx1 <= pyxel.mouse_x < tx1 + 8 and ty1 <= pyxel.mouse_y < ty1 + 8:
x = tx1
y = ty1
y -= 3
perso_select_p = False
if pyxel.btnp(pyxel.MOUSE_BUTTON_RIGHT) and x <= pyxel.mouse_x < x + 8 and y <= pyxel.mouse_y < y + 8:
x = 0
y = 0
##select draco
##Select
if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and dx <= pyxel.mouse_x < dx + 8 and dy <= pyxel.mouse_y < dy + 8:
if perso_select_d == False:
dx = dx + 4
perso_select_d = True
else :
dx = dx - 4
perso_select_d = False
##Select toure
if perso_select_d == True and tx2 <= pyxel.mouse_x < tx2 + 8 and ty2 <= pyxel.mouse_y < ty2 + 8:
dx = tx2
dy = ty2
dy -= 3
perso_select_d = False
if pyxel.btnp(pyxel.MOUSE_BUTTON_RIGHT) and dx <= pyxel.mouse_x < dx + 8 and dy <= pyxel.mouse_y < dy + 8:
dx = 0
dy = 8
##Ennemies
if y1 < 113:
y1 += 0.5
else :
y1 = 0
pv -= 10
if pv <= 0:
pyxel.cls(0)
pyxel.text(47, 40, "GAME OVER",8)
def draw():
pyxel.cls(0)
##Gameover
if gameover:
pyxel.bltm(0, 0, 1, 0, 0, 128, 128, colkey=2)
pyxel.text(47, 40, "GAME OVER",8)
##Map
pyxel.bltm(0, 0, 0, 0, 0, 128, 128, colkey=2)
##Perso
##pika:
t = pyxel.frame_count%40
if t < 20:
pyxel.blt(x, y, 0, 0, 0, 8, 8, colkey=2)
else:
pyxel.blt(x, y, 0, 8, 0, 8, 8, colkey=2)
##draco:
if t < 20:
pyxel.blt(dx, dy, 0, 16, 0, 8, 8, colkey=2)
else:
pyxel.blt(dx, dy, 0, 24, 0, 8, 8, colkey=2)
##Ennemies
t = pyxel.frame_count%20
if t < 10:
pyxel.blt(x1, y1, 0, 32, 0, 8, 8, colkey=2)
else:
pyxel.blt(x1, y1, 0, 40, 0, 8, 8, colkey=2)
##Attaque
pyxel.run(update, draw)