Discord
Login
Community
DARK THEME

I have a problem of making enemies die when they are stepped on

I want the enemies to die when they are stepped on, I have tried for hours, can anyone help me. That would be nice. :) here is the game: https://microstudio.io/i/Tiberius/supermariobros/

Hi Tiberius, great Mario game, love it!

Here is a fix to get you started. The trick is to check if your player is falling when touching an enemy. In player line 105

// handle touching hazards
if tile_touched.startsWith("goomba") then
  if player.y_velocity < 0 then
    player.x += 10 // this is just a hack, remove goomba instead
    print("goomba dead!")
  else
    respawnPlayer()
    game_lives -= 1
    return
  end
end

I hope this helps.

You can make them have two hitboxes: one on top that makes them get killed by the player and one on the bottom that makes them kill the player.

I will see if nightshade's code works. (nightshade, thank you for saying that the mario game is good, it took me about 5 hours to make all of this sprites.)

perfect! it works! thank you nightshade, this will help me a lot. I got the rest. :)

(by the way nightshade, me and gurg0 are making another super mario bros in microstudio the game. thank you night shade for doing this, this is going to be used.)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community