def onStart(): global score_add, score, player, counter player = game.Box(color=game.ORANGE, size=(40, 40), speed=(4, 4), radius=.4, tag="player") player.collision = onCollisionPlayer game.Image("images/coins.png", position=(10, 10)) score = game.Label(0, position=(45, 0), color=game.LIGHT_CHOCOLATE) score.format = int for i in range(random.randint(2, 4)): addRandom("inc", game.INDEGO, None) for i in range(random.randint(2, 4)): addRandom("dec", game.GREEN, None) for i in range(random.randint(6, 8)): addRandom("bomb", game.RED, onClickBomb) game.sleep(3) game.sound("sfx/123start.wav")
game.remove("bomb") game.pause = False for i in range(10): z = random.randint(5, 10) x = random.randint(100, 600) y = random.randint(0, 380) sx = random.random() - .5 sy = random.random() * -5 b = game.Ellipse(position=(x, y), size=(z, z), color=game.RED, speed=(sx, sy), tag="bomb") b.bound = False b.out = bombOut player = game.Image("images/brick.png", position=(260, 400)) player.moveBy(("Up", "Left", "Down", "Right"), 10) game.Image("images/life.png", position=(10, 10)) health = game.Label(20, position=(50, 0)) game.Image("images/star.png", position=(700, 10)) score = game.Label(0, position=(740, 0)) score.format = int player.collision = playerCollision game.frame = onFrame Restart(0) game.mainloop()
import helligame as game game.Image("images/stadium800.jpg") game.Image("images/football.png", (384, 264)) game.Label(0, (10, 0), color=game.RED) game.Label(0, (770, 0), color=game.BLUE) game.Box((0, 180), (10, 200), color=game.RED, alpha=.2) game.Box((790, 180), (10, 200), color=game.BLUE, alpha=.2) game.mainloop("football", -1, 800, 560)
import helligame as game i = 0 def click(): global i i = (i + 1) % 2 if i == 0: coin.load("images/coin1.png") else: coin.load("images/coins.png") coin = game.Image("images/coin1.png", (385, 265)) game.Label("click on image", (290, 300)) coin.click = click game.mainloop("sprite", game.SKY, 800, 560)
import helligame as game img = [ "images/walk1.png", "images/walk2.png", "images/walk3.png", "images/walk4.png" ] player = game.Image(images=img, position=(364, 237)) player.addTimer(.2, player.next, autorestart=True) game.mainloop("sprite", game.SKY, 800, 560) game.quit()