import random
WIDTH =
HEIGHT =
status = 0
point = 0
bomb = 0
timer1 = 0
timer2 = 0
start = 0
Maxpoint = 0
x1 = random.randint(, )
x2 = random.randint(, )
x3 = random.randint(, )
x4 = random.randint(, )
x5 = random.randint(, )
player = Actor("p3_front", center=(500, 760))
coin1 = Actor("coin", midbottom=(x1, 0))
coin2 = Actor("coin", midbottom=(x2, -100))
coin3 = Actor("coin", midbottom=(x3, -300))
coin4 = Actor("coin", midbottom=(x4, -500))
bombs = Actor("bomb", midbottom=(x5, -100))
def draw():
global status, point, strat, Maxpoint, timer2, bomb
if (bomb < 5) and (timer2 < 120) and (start == 1):
screen.draw.text(
"point " + str(point), (10, 20), fontsize=32, color=(0, 0, 0)
)
screen.draw.text("bomb " + str(bomb), (10, 50), fontsize=32, color=(0, 0, 0))
screen.draw.text(
"time " + str(timer2), (10, 80), fontsize=32, color=(0, 0, 0)
)
if status == 1:
if start == 0:
screen.draw.text(
"Maxpoint " + str(Maxpoint), (370, 350), fontsize=80, color=(0, 0, 0)
)
if (bomb >= 5) or (timer2 >= 120):
if Maxpoint <= point:
Maxpoint = point
screen.draw.text(
"point " + str(point) + "\nMaxpoint " + str(Maxpoint),
(370, 350),
fontsize=80,
color=(0, 0, 0),
)
def on_key_down(key):
global start, x1, x2, x3, x4, x5, bomb, timer1, timer2, status, point, Maxpoint
if key == keys.SPACE:
start = 1
if key == keys.M:
start = 0
status = 0
bomb = 0
timer1 = 0
timer2 = 0
point = 0
player.x = 500
x1 = random.randint(30, 970)
coin1.x = x1
coin1.y = 0
x2 = random.randint(30, 970)
coin2.x = x2
coin2.y = -100
x3 = random.randint(30, 970)
coin3.x = x3
coin3.y = -300
x4 = random.randint(30, 970)
coin4.x = x4
coin4.y = -500
x5 = random.randint(30, 970)
bombs.x = x5
bombs.y = -100
def update():
global status, point, x1, x2, x3, x4, x5, bomb, timer1, timer2, strat
if (bomb < 5) and (timer2 < 120) and (start == 1):
timer1 += 1
if status == 1:
timer2 = timer1 / 60
timer2 = int(timer2)
if coin1.top >= HEIGHT:
x1 = random.randint(30, 970)
coin1.x = x1
coin1.y = 0
if coin2.top >= HEIGHT:
x2 = random.randint(30, 970)
coin2.x = x2
coin2.y = 0
if coin3.top >= HEIGHT:
x3 = random.randint(30, 970)
coin3.x = x3
coin3.y = 0
if coin4.top >= HEIGHT:
x4 = random.randint(30, 970)
coin4.x = x4
coin4.y = 0
if bombs.top >= HEIGHT:
x5 = random.randint(30, 970)
bombs.x = x5
bombs.y = 0
if keyboard.a:
if player.left >= 0:
if keyboard.d:
if player.right <= WIDTH:
if player.colliderect(coin1):
sounds.coinon.play()
x1 = random.randint(30, 970)
coin1.x = x1
coin1.y = 0
point += 1
if player.colliderect(coin2):
sounds.coinon.play()
x2 = random.randint(30, 970)
coin2.x = x2
coin2.y = 0
point += 1
if player.colliderect(coin3):
sounds.coinon.play()
x3 = random.randint(30, 970)
coin3.x = x3
coin3.y = 0
point += 1
if player.colliderect(coin4):
sounds.coinon.play()
x4 = random.randint(30, 970)
coin4.x = x4
coin4.y = 0
point += 1
if player.colliderect(bombs):
sounds.bombon.play()
x5 = random.randint(30, 970)
bombs.x = x5
bombs.y = 0
bomb += 1
point -= 5
"""if point >= :
status = 1"""
To embed this project on your website, copy the following code and paste it into your website's HTML: