Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    How to put maps in your game

    Help
    2
    6
    366
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Judddd last edited by Judddd

      I’m making a game I got the player sprite to move how I wanted but I don’t know how to put the map I made for it onto the screen.

      1 Reply Last reply Reply Quote 0
      • Z-Mann
        Z-Mann last edited by

        Outside of your game loop, you use loadMap() to load your map, and then in the game loop, before drawSprites(), you use drawMap() to display the map. And, if your map contains animations, you also call updateMap(), usually before drawMap.

        1 Reply Last reply Reply Quote 3
        • J
          Judddd last edited by

          Thank you Z-Mann

          1 Reply Last reply Reply Quote 0
          • J
            Judddd last edited by Judddd

            I got the map to appear but I can’t get the collision to work

            1 Reply Last reply Reply Quote 0
            • J
              Judddd last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • Z-Mann
                Z-Mann last edited by

                That would be collideMap(yourSprite), in the simplest case. That will move yourSprite out of the way of any collision zones of your map.

                Depending on your game, you will need to do additional work. If you keep the desired location of your character in a variable, you need to read it out post-collision with getSpriteLocation().

                If your character is supposed to have momentum/velocity, that is if it's not instantly stopping if you center the stick, you'll need to understand and use the returned data of collideMap and use it to modify the velocity so that further movement does not drive you further into the collision zones. Or maybe you want to bounce off walls. That is all

                , very hard to explain in a vacuum and you probably don't need it at first.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post