Skip to content

Commit

Permalink
deathMario new con animacion
Browse files Browse the repository at this point in the history
  • Loading branch information
polmarrod committed Dec 12, 2023
1 parent 2e0d294 commit 443de93
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 24 deletions.
47 changes: 34 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def on_on_overlap(sprite3, otherSprite2):
sprites.destroy(otherSprite2)
info.change_score_by(100)
else:
deathMario()
actualizeHitMario()
sprites.on_overlap(SpriteKind.player, SpriteKind.Shroom, on_on_overlap)

def on_down_pressed():
Expand Down Expand Up @@ -371,29 +371,48 @@ def on_right_pressed():
True)
if marioLevel.tile_kind_at(TileDirection.RIGHT, assets.tile("""tube_right_top0 """)):
tiles.set_current_tilemap(tilemap("""level_1_0"""))
tiles.place_on_tile(marioLevel, tiles.get_tile_location(166, 11))
tiles.place_on_tile(marioLevel, tiles.get_tile_location(166, 10))

controller.right.on_event(ControllerButtonEvent.PRESSED, on_right_pressed)

def deathMario():
def actualizeHitMario():
global tall
if tall == 1 :
if tall == 1 :
tall = 0
if facingRight:
marioLevel.set_image(assets.image("""mario_right"""))
else:
marioLevel.set_image(assets.image("""mario_left"""))
else:
info.stop_countdown()
info.change_life_by(-1)
info.set_score(0)
info.change_countdown_by(400 - info.countdown())
tiles.set_current_tilemap(tilemap("""level_1_0"""))
tiles.place_on_tile(marioLevel, tiles.get_tile_location(0, 12))
animation.stop_animation(animation.AnimationTypes.ALL, marioLevel)
controller.move_sprite(marioLevel,0,0)
sprites.destroy_all_sprites_of_kind(SpriteKind.Shroom)
sprites.destroy_all_sprites_of_kind(SpriteKind.Turtle)
sprites.destroy_all_sprites_of_kind(SpriteKind.Shell)
spawnEnemies()
sprites.destroy_all_sprites_of_kind(SpriteKind.food)
marioLevel.set_image(assets.image("""mario_death"""))
marioLevel.vy = -100
marioLevel.ay = 400
tiles.set_wall_at(tiles.get_tile_location(marioLevel.tilemap_location().column,14), False)
tiles.set_wall_at(tiles.get_tile_location(marioLevel.tilemap_location().column,15), False)
tiles.set_wall_at(tiles.get_tile_location(marioLevel.tilemap_location().column+1,14), False)
tiles.set_wall_at(tiles.get_tile_location(marioLevel.tilemap_location().column+1,15), False)
tiles.set_wall_at(tiles.get_tile_location(marioLevel.tilemap_location().column-1,14), False)
tiles.set_wall_at(tiles.get_tile_location(marioLevel.tilemap_location().column-1,15), False)

def deathMario():
info.stop_countdown()
info.change_life_by(-1)
info.set_score(0)
info.change_countdown_by(400 - info.countdown())
tiles.set_current_tilemap(tilemap("""level_1_0"""))
tiles.place_on_tile(marioLevel, tiles.get_tile_location(0, 12))
sprites.destroy_all_sprites_of_kind(SpriteKind.Shroom)
sprites.destroy_all_sprites_of_kind(SpriteKind.Turtle)
sprites.destroy_all_sprites_of_kind(SpriteKind.Shell)
marioLevel.vy = 0
marioLevel.ay = 350
controller.move_sprite(marioLevel,100,0)
spawnEnemies()

def on_left_pressed():
global facingRight
Expand Down Expand Up @@ -439,7 +458,7 @@ def on_on_overlap2(sprite22, otherSprite22):
tiles.place_on_tile(shell, otherSprite22.tilemap_location())
shell.ay = 350
else:
deathMario()
actualizeHitMario()
sprites.on_overlap(SpriteKind.player, SpriteKind.Turtle, on_on_overlap2)

def on_a_pressed():
Expand Down Expand Up @@ -617,7 +636,9 @@ def on_on_update2():
"""))
game.on_update(on_on_update2)
def checkFall():
global tall
if marioLevel.tilemap_location().row == 15:
tall = 0
deathMario()
for value in sprites.all_of_kind(SpriteKind.Shroom):
if value.tilemap_location().row == 15:
Expand Down
45 changes: 34 additions & 11 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Shroom, function on_on_overlap(s
sprites.destroy(otherSprite2)
info.changeScoreBy(100)
} else {
deathMario()
actualizeHitMario()
}

})
Expand Down Expand Up @@ -393,13 +393,13 @@ controller.right.onEvent(ControllerButtonEvent.Pressed, function on_right_presse

if (marioLevel.tileKindAt(TileDirection.Right, assets.tile`tube_right_top0 `)) {
tiles.setCurrentTilemap(tilemap`level_1_0`)
tiles.placeOnTile(marioLevel, tiles.getTileLocation(166, 11))
tiles.placeOnTile(marioLevel, tiles.getTileLocation(166, 10))
}

}

})
function deathMario() {
function actualizeHitMario() {

if (tall == 1) {
tall = 0
Expand All @@ -410,20 +410,41 @@ function deathMario() {
}

} else {
info.stopCountdown()
info.changeLifeBy(-1)
info.setScore(0)
info.changeCountdownBy(400 - info.countdown())
tiles.setCurrentTilemap(tilemap`level_1_0`)
tiles.placeOnTile(marioLevel, tiles.getTileLocation(0, 12))
animation.stopAnimation(animation.AnimationTypes.All, marioLevel)
controller.moveSprite(marioLevel, 0, 0)
sprites.destroyAllSpritesOfKind(SpriteKind.Shroom)
sprites.destroyAllSpritesOfKind(SpriteKind.Turtle)
sprites.destroyAllSpritesOfKind(SpriteKind.Shell)
spawnEnemies()
sprites.destroyAllSpritesOfKind(SpriteKind.Food)
marioLevel.setImage(assets.image`mario_death`)
marioLevel.vy = -100
marioLevel.ay = 400
tiles.setWallAt(tiles.getTileLocation(marioLevel.tilemapLocation().column, 14), false)
tiles.setWallAt(tiles.getTileLocation(marioLevel.tilemapLocation().column, 15), false)
tiles.setWallAt(tiles.getTileLocation(marioLevel.tilemapLocation().column + 1, 14), false)
tiles.setWallAt(tiles.getTileLocation(marioLevel.tilemapLocation().column + 1, 15), false)
tiles.setWallAt(tiles.getTileLocation(marioLevel.tilemapLocation().column - 1, 14), false)
tiles.setWallAt(tiles.getTileLocation(marioLevel.tilemapLocation().column - 1, 15), false)
}

}

function deathMario() {
info.stopCountdown()
info.changeLifeBy(-1)
info.setScore(0)
info.changeCountdownBy(400 - info.countdown())
tiles.setCurrentTilemap(tilemap`level_1_0`)
tiles.placeOnTile(marioLevel, tiles.getTileLocation(0, 12))
sprites.destroyAllSpritesOfKind(SpriteKind.Shroom)
sprites.destroyAllSpritesOfKind(SpriteKind.Turtle)
sprites.destroyAllSpritesOfKind(SpriteKind.Shell)
marioLevel.vy = 0
marioLevel.ay = 350
controller.moveSprite(marioLevel, 100, 0)
spawnEnemies()
}

controller.left.onEvent(ControllerButtonEvent.Pressed, function on_left_pressed() {

if (level == 1) {
Expand Down Expand Up @@ -470,7 +491,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Turtle, function on_on_overlap2(
tiles.placeOnTile(shell, otherSprite22.tilemapLocation())
shell.ay = 350
} else {
deathMario()
actualizeHitMario()
}

})
Expand Down Expand Up @@ -674,7 +695,9 @@ game.onUpdate(function on_on_update2() {

})
function checkFall() {

if (marioLevel.tilemapLocation().row == 15) {
tall = 0
deathMario()
}

Expand Down

0 comments on commit 443de93

Please sign in to comment.