Discord
Login
Community
DARK THEME

Why don't my map collisions work?

Link to the code - https://microstudio.dev/i/MrBoi/enemiesasweapons/

What's wrong with it?

Thanks in advance :)

whats sposed to be colliding

in class Player function MapCollisions

    if checkMapCollision(old_left,player.y,"lava",level_width,level_height) == "lava_tile" then
      if vx > 0 then player.vx=0 end
    elsif checkMapCollision(old_right,player.y,"lava",level_width,level_height) == "lava_tile" then
      if vx < 0 then player.vx=0 end
    end
    if checkMapCollision(player.x,old_bottom,"lava",level_width,level_height) == "lava_tile" then
      if vy > 0 then player.vy=0 end
    elsif checkMapCollision(player.x,old_up,"lava",level_width,level_height) == "lava_tile" then
      if vy < 0 then player.vy=0  end
    end

in class Player function update

  update = function()
    // adding the velocity to alter the x and y coordinates
    x += vx
    y += vy

    Movement()  
    MapCollisions()
    Animations()
    Borders()
  end

Post a reply

Progress

Status

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