In my game, the player (sprite) keeps going through my other sprite (wall), so how can i stop that?
I need help to stop my sprite from going through a another sprite, if it helps the sprite called player, keeps walking through from my other sprite, called wall.
Thank you for your help, but only the second link is helpful, so when I try to use the code, it has so many problems, is there any code that will make a sprite unable to go through another sprite, any help will be great though
if it helps here is a link to my project
https://microstudio.io/Arctic_Oak/dungeon012/7R9EDZNC/
if you copy and paste it on google, you will see the player will go through walls which is not good
Can you send the link to your project so we can see your code?
This is all my code, I've put it in one folder called main,
init = function() player = object end player.x = 0 player y = 0 player.speed = 2 // pixels per frame end
update = function()
// player movement if keyboard.UP or gamepad.UP then player.y += player.speed end
if keyboard.DOWN or gamepad.Down then player.y -= player.speed end
if keyboard.RIGHT or gamepad.RIGHT then player.x += player.speed end
if keyboard.LEFT or gamepad.LEFT then player.x -= player.speed end
end
draw = function() // set up the screen screen.clear() // draw the player screen.drawSprite("player", player.x, player.y, 30, 30) // draw game screen.drawSprite("wall", 60, -10, 25) screen.drawSprite("wall", -50, -10, 25) screen.drawSprite("wall", 60, 15, 25) screen.drawSprite("wall", -50, 15, 25) screen.drawSprite("wall", 60, -30, 25) screen.drawSprite("wall", -50, -30, 25) end