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 :)
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