Discord
Login
Community
DARK THEME

door

how would i code a door that takes you to another map?

I didn't include every bit of code, I'll leave you to find out that stuff yourself──but it would look something like this.

init = function()
  map = "map1"

  player = object
    position = [0, 0]
    getMapPos = function(map)
      * map collision code here *
    end
  end
end

update = function()
  if player.getMapPos(map) == "door" then
    map = "map2"
    position = * some set position for clean transition *
  end
end

draw = function()
  screen.drawSprite("player", player.position[0], player.position[1], 25, 25)
  screen.drawMap(map, 0, 0, screen.height, screen.height) // assuming its a square map
end

its not working init = function() dungeon = "dungeon" kitchen = "kitchen" end

player = object position = [0,0] getMapPos = function(map) end end

update = function() if player.getMapPos == "door" then kitchen = "kitchen" position = [50, -14] end end draw = function() screen.drawSprite("playeridle", player.position[0], player.position[1], 25, 25) screen.drawMap(kitchen,230,68,230,200) end

Post a reply

Progress

Status

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