373 lines
29 KiB
Python
373 lines
29 KiB
Python
def on_up_pressed():
|
|
global py
|
|
py = 1
|
|
controller.up.on_event(ControllerButtonEvent.PRESSED, on_up_pressed)
|
|
|
|
def on_b_pressed():
|
|
global projectile
|
|
music.pew_pew.play()
|
|
projectile = sprites.create_projectile_from_sprite(img("""
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . 2 2 . . . . . . .
|
|
. . . . . . 3 1 1 3 . . . . . .
|
|
. . . . . 2 1 1 1 1 2 . . . . .
|
|
. . . . . 2 1 1 1 1 2 . . . . .
|
|
. . . . . . 3 1 1 3 . . . . . .
|
|
. . . . . . . 2 2 . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
"""),
|
|
mySprite,
|
|
px * 200,
|
|
py * -200)
|
|
controller.B.on_event(ControllerButtonEvent.PRESSED, on_b_pressed)
|
|
|
|
def on_a_pressed():
|
|
if mySprite.vy == 0:
|
|
music.footstep.play()
|
|
mySprite.vy = -150
|
|
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)
|
|
|
|
def on_down_released():
|
|
global py
|
|
py = 0
|
|
controller.down.on_event(ControllerButtonEvent.RELEASED, on_down_released)
|
|
|
|
def on_overlap_tile(sprite, location):
|
|
global canTP
|
|
if canTP:
|
|
music.knock.play()
|
|
tiles.place_on_random_tile(mySprite, sprites.dungeon.door_open_north)
|
|
canTP = 0
|
|
scene.on_overlap_tile(SpriteKind.player,
|
|
sprites.dungeon.door_closed_north,
|
|
on_overlap_tile)
|
|
|
|
def on_up_released():
|
|
global py
|
|
py = 0
|
|
controller.up.on_event(ControllerButtonEvent.RELEASED, on_up_released)
|
|
|
|
def on_down_pressed():
|
|
global py
|
|
py = -1
|
|
controller.down.on_event(ControllerButtonEvent.PRESSED, on_down_pressed)
|
|
|
|
def on_menu_pressed():
|
|
global _type
|
|
if _type:
|
|
typeSprite.set_image(assets.image("""
|
|
red
|
|
"""))
|
|
_type = 0
|
|
else:
|
|
typeSprite.set_image(assets.image("""
|
|
blue
|
|
"""))
|
|
_type = 1
|
|
controller.menu.on_event(ControllerButtonEvent.PRESSED, on_menu_pressed)
|
|
|
|
def on_overlap_tile2(sprite2, location2):
|
|
game.over(False)
|
|
scene.on_overlap_tile(SpriteKind.player,
|
|
sprites.swamp.swamp_tile7,
|
|
on_overlap_tile2)
|
|
|
|
def on_hit_wall(sprite3, location3):
|
|
if not (tiles.tile_at_location_equals(location3, sprites.dungeon.floor_dark0)):
|
|
for value in tiles.get_tiles_by_type(sprites.dungeon.door_closed_north):
|
|
tiles.set_tile_at(value, sprites.castle.tile_path5)
|
|
tiles.set_wall_at(value, True)
|
|
tiles.set_tile_at(location3, sprites.dungeon.door_closed_north)
|
|
tiles.set_wall_at(location3, False)
|
|
scene.on_hit_wall(SpriteKind.projectile, on_hit_wall)
|
|
|
|
def on_overlap_tile3(sprite4, location4):
|
|
game.over(False)
|
|
scene.on_overlap_tile(SpriteKind.player,
|
|
sprites.swamp.swamp_tile9,
|
|
on_overlap_tile3)
|
|
|
|
def on_overlap_tile4(sprite5, location5):
|
|
global level
|
|
level += 1
|
|
if level == len(levels):
|
|
game.over(True)
|
|
else:
|
|
music.ba_ding.play()
|
|
startLevel()
|
|
scene.on_overlap_tile(SpriteKind.player,
|
|
sprites.dungeon.collectible_red_crystal,
|
|
on_overlap_tile4)
|
|
|
|
def startLevel():
|
|
scene.set_background_image(img("""
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999d99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
999999999999999999999999999dd999999d9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
999999999999999999999999999ddd99999d999999999999d999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999ddddd9999dd9999999999ddd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999ddddddd999dd9999999999ddd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999d9dddd999ddd999999999ddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999ddddd999dddd99999999dddddd999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999ddddddd999dd9999999999dddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999dddd9dd99ddd9999999dddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999dddddd999ddd999999999dddddd999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
999999999999999999999999dd9ddddd99dddd9999999ddddd9dd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999dddddddddddd999999ddddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999ddddddddddddddddddd99dddddd999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999d9999999999ddddddddddddddddddddd99dddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999d999999999999999999
|
|
999999999999ddd99999999999ddddddddddddddddddddddd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999d9999dd999999999999999999
|
|
999999999999dd9999999999dddddddddddddddddddddddddd9999999999999999999999999999999999d99999999999999999999999999999999999999999999999999dd999dd999999999999999999
|
|
99999999999ddd999999999dddddddddddddddddddddddddddd999999999999999999999999999999999dd9999999999999999999999999999999999999999999999999dd99ddd999999999999999999
|
|
9999999999ddddd999999ddddddddddddddddddddddddddddddd99999999999999999999999999999999dd99999999999999999999999999999999999999999999d999dddd9ddddd9999999999999999
|
|
99999999999ddd99999dddddddddddddddddddddddddddddddddd999999999999999999999999999999dddd999999999999999999999999999999999999999999ddd99dddd99dd999999999999999999
|
|
999999999999ddd999dddddddddddddddddddddddddddddddddddd99999999999999999999999999999dddd9999d9999999999999999999999999999999999999ddd999dd99dddddd999999999999999
|
|
9999999999dddd99ddddddddddddddddddddddddddddddddddddddd999999999999999999999dd999999dd99999d999999999999999999999999999999999999dddd9ddddddddd999999999d99999999
|
|
99999999999ddddddddddddddddddddddddddddddddddddddddddddd9999999999999999999ddd9999dddddd999dd9999999999999999999999999999999999999ddd9dddd999dd99999999d99999999
|
|
999999999999ddddddddddddddddddddddddddddddddddddddddddddd99999999999999999dddd99999dddd9999dd999999999999999999999999999999999999ddd99ddddd99d99999999dddd999999
|
|
999999999999dddddddddddddddddddddddddddddddddddddddddddddd999999999999999999ddd9999ddddd99ddd9999999999999d99999999999999999999ddddddddddddd9d999999999d99999999
|
|
99999999999ddddddddddddddddddddddddddddddddddddddddddddddd9999999999999999dddddd9dddddddd9dddd99999999999dd999999999999999999999ddddddddddddddddd9999dddd9999999
|
|
9999999999ddddddddddddddddddddddddddddddddddddddddddddddddd99999999999999dddddd9dddddddddd9dd999999999999ddd9999999999999d99999ddddd99ddddddddddddd999ddd9999999
|
|
99999999dddddddddddddddddddddddddddddddddddddddddddddddddddd999999999999999dddddd99dddd9999ddd9999999999ddddd999999999999d9999dddddddddddddddddddddd99ddddd99999
|
|
9999999dddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999999dddddd99dddddd99ddd9999999999ddddddd99999999999dd99999dddddddddddddddddddddddddd999999
|
|
999999dddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999999999ddddddddddddddddddddddd9999999d9dddd999999999999dd9999dddddddddddddddddddddddddd9999999
|
|
99999dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999999ddddddddddddddddddddddd99999ddddd99999999999ddd9999dddddddddddddddddddddddddd9999999
|
|
999ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999999999dddddddddddddddddddddddddd99ddddddd99999999999d9999dddddddddddddddddddddddddddd999999
|
|
99ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999999dddddddddddddddddddddddddddddd9dddd9d9999999999dddd99dddddddddddddddddddddddddddddd9999
|
|
9dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999ddddddddddddddddddddddddddddddddddddd999999999999dd99ddddddddddddddddddddddddddddddddd99
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd999ddddddddddddddddddddddddddddddddddddddd999999999ddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999dddddddddddddddddddddddddddddddddddddddd
|
|
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999ddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999ddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999dddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
"""))
|
|
tiles.set_current_tilemap(levels[level])
|
|
mySprite.set_position(75, 40)
|
|
game.show_long_text(levelStartMessage[level], DialogLayout.BOTTOM)
|
|
|
|
def on_overlap_tile5(sprite6, location6):
|
|
global canTP
|
|
if canTP:
|
|
music.knock.play()
|
|
tiles.place_on_random_tile(mySprite, sprites.dungeon.door_closed_north)
|
|
canTP = 0
|
|
scene.on_overlap_tile(SpriteKind.player,
|
|
sprites.dungeon.door_open_north,
|
|
on_overlap_tile5)
|
|
|
|
canTP = 0
|
|
px = 0
|
|
projectile: Sprite = None
|
|
py = 0
|
|
level = 0
|
|
levelStartMessage: List[str] = []
|
|
levels: List[tiles.TileMapData] = []
|
|
_type = 0
|
|
typeSprite: Sprite = None
|
|
mySprite: Sprite = None
|
|
scene.set_background_image(assets.image("""
|
|
myImage
|
|
"""))
|
|
pause(500)
|
|
scene.set_background_image(assets.image("""
|
|
myImage0
|
|
"""))
|
|
pause(100)
|
|
mySprite = sprites.create(img("""
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . f f f f f f . . . . .
|
|
. . . f f e e e e f 2 f . . . .
|
|
. . f f e e e e f 2 2 2 f . . .
|
|
. . f e e e f f e e e e f . . .
|
|
. . f f f f e e 2 2 2 2 e f . .
|
|
. . f e 2 2 2 f f f f e 2 f . .
|
|
. f f f f f f f e e e f f f . .
|
|
. f f e 4 4 e b f 4 4 e e f . .
|
|
. f e e 4 d 4 1 f d d e f . . .
|
|
. . f e e e e e d d d f . . . .
|
|
. . . . f 4 d d e 4 e f . . . .
|
|
. . . . f e d d e 2 2 f . . . .
|
|
. . . f f f e e f 5 5 f f . . .
|
|
. . . f f f f f f f f f f . . .
|
|
. . . . f f . . . f f f . . . .
|
|
"""),
|
|
SpriteKind.player)
|
|
scene.camera_follow_sprite(mySprite)
|
|
controller.move_sprite(mySprite, 100, 0)
|
|
mySprite.ay = 500
|
|
typeSprite = sprites.create(assets.image("""
|
|
red
|
|
"""), SpriteKind.player)
|
|
_type = 0
|
|
levels = [tilemap("""
|
|
level6
|
|
"""),
|
|
tilemap("""
|
|
level1
|
|
"""),
|
|
tilemap("""
|
|
level3
|
|
"""),
|
|
tilemap("""
|
|
level4
|
|
"""),
|
|
tilemap("""
|
|
level5
|
|
"""),
|
|
tilemap("""
|
|
level7
|
|
""")]
|
|
levelStartMessage = ["This is portal.py, you need to find the edgeless yum cube to find pass this test.",
|
|
"You now have a portal device, use b to place portals",
|
|
"You are much faster at this than the others",
|
|
"some portals require great timing",
|
|
"some portals require you to look up when you place them",
|
|
"You, can't portal through bricks."]
|
|
level = 5
|
|
music.set_volume(20)
|
|
for index in range(2):
|
|
music.play_melody("E B C5 A B G A F ", 220)
|
|
startLevel()
|
|
|
|
def on_on_update():
|
|
typeSprite.set_position(scene.camera_property(CameraProperty.X) + scene.screen_width() / 2 - 8,
|
|
scene.camera_property(CameraProperty.Y) - scene.screen_height() / 2 + 8)
|
|
game.on_update(on_on_update)
|
|
|
|
def on_update_interval():
|
|
global canTP
|
|
canTP = 1
|
|
game.on_update_interval(1000, on_update_interval)
|
|
|
|
def on_forever():
|
|
global px
|
|
if mySprite.vx < 0:
|
|
mySprite.set_image(img("""
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . f f f f f f . . . . . .
|
|
. . . f 2 f e e e e f f . . . .
|
|
. . f 2 2 2 f e e e e f f . . .
|
|
. . f e e e e f f e e e f . . .
|
|
. f e 2 2 2 2 e e f f f f . . .
|
|
. f 2 e f f f f 2 2 2 e f . . .
|
|
. f f f e e e f f f f f f f . .
|
|
. f e e 4 4 f b e 4 4 e f f . .
|
|
. . f e d d f 1 4 d 4 e e f . .
|
|
. . . f d d d e e e e e f . . .
|
|
. . . f e 4 e d d 4 f . . . . .
|
|
. . . f 2 2 e d d e f . . . . .
|
|
. . f f 5 5 f e e f f f . . . .
|
|
. . f f f f f f f f f f . . . .
|
|
. . . f f f . . . f f . . . . .
|
|
"""))
|
|
px = -1
|
|
if mySprite.vx > 0:
|
|
mySprite.set_image(img("""
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . f f f f f f . . . . .
|
|
. . . f f e e e e f 2 f . . . .
|
|
. . f f e e e e f 2 2 2 f . . .
|
|
. . f e e e f f e e e e f . . .
|
|
. . f f f f e e 2 2 2 2 e f . .
|
|
. . f e 2 2 2 f f f f e 2 f . .
|
|
. f f f f f f f e e e f f f . .
|
|
. f f e 4 4 e b f 4 4 e e f . .
|
|
. f e e 4 d 4 1 f d d e f . . .
|
|
. . f e e e e e d d d f . . . .
|
|
. . . . f 4 d d e 4 e f . . . .
|
|
. . . . f e d d e 2 2 f . . . .
|
|
. . . f f f e e f 5 5 f f . . .
|
|
. . . f f f f f f f f f f . . .
|
|
. . . . f f . . . f f f . . . .
|
|
"""))
|
|
px = 1
|
|
forever(on_forever)
|