I can’t make it so that there is a collision in the walls and the camera stops when the player hits the wall
here are my attempts
this is my movement code
local function update()
local movedistanceX = player.speed * (joystick.thumbX - joystick.stickX) / joystick.thumblimit
local movedistanceY = player.speed * (joystick.thumbY - joystick.stickY) / joystick.thumblimit
local length = math.sqrt(movedistanceX^2 + movedistanceY^2)
local normalX = length > 0 and (movedistanceX / length) * player.speed or 0
local normalY = length > 0 and (movedistanceY / length) * player.speed or 0
--here is the camera code that is in the video
--for i = 1, map.numChildren do
--map[i]:setLinearVelocity(-normalX, -normalY)
--end
player.hitbox:setLinearVelocity(normalX, normalY)
player.x = player.hitbox.x
player.y = player.hitbox.y
sprite.x = player.x
sprite.y = player.y
end
Runtime:addEventListener("enterFrame", update)