Navigation

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

    fallow camera 2D

    Help
    6
    8
    282
    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
      JonnyLaw F last edited by

      how would i make the center of the screen be the players x y coordinates in a 2D game?

      1 Reply Last reply Reply Quote 0
      • pianofire
        pianofire Fuze Team last edited by

        If you are using sprites you should be able to use

        setSptiteCamera( player.x, player.y )
        
        J 1 Reply Last reply Reply Quote 0
        • J
          JonnyLaw F @pianofire last edited by

          @pianofire is there any other way without sprites? id like to skip adding sprites until i get the basic game mechanic working properly

          1 Reply Last reply Reply Quote 0
          • Jaywalker
            Jaywalker Donator last edited by Jaywalker

            You can use setMode setView(cameraX, cameraY, resX, resY) but I don't know if it brakes something.
            Otherwise, just add cameraX and cameraY to the playerCoordinates when you draw it.

            1 Reply Last reply Reply Quote 0
            • Martin
              Martin Fuze Team last edited by

              @Jaywalker setMode() only accepts 2 parameters: width and height

              1 Reply Last reply Reply Quote 2
              • Jaywalker
                Jaywalker Donator last edited by

                whoops, meant setView, thanks for pointing out @Martin

                1 Reply Last reply Reply Quote 1
                • M
                  MikeDX last edited by

                  setView() doesn't respect all drawing commands so may not be relied upon

                  1 Reply Last reply Reply Quote 0
                  • D
                    doumdoum F last edited by

                    I hope it will help.
                    Correct me if it's wrong
                    CenterCamera.jpg

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