How do I have an object act as though in the UI

0 favourites
  • 5 posts
From the Asset Store
Bring a cool, frosty look to your game with the Frosty UI Kit.
  • The pointer has 8 direction control (the yellow circle). The gun has its angle set towards it. In the UI it doesnt work, so the circle is on normal game layers. But I need it to be confined to the screen, and to not move when the player moves. basically to act like it is in the UI. Unless theres a way to have it on the UI layer and get the angle to it properly?

    Thank you!

  • You can use CanvasToLayer and LayerToCanvas to get the X Y of an object on a different layer

    example

    CanvasToLayerX("UI",LayerToCanvasX("game",object.x,object.y),LayerToCanvasY("game",object.x,object.y))

    CanvasToLayerY("UI",LayerToCanvasX("game",object.x,object.y),LayerToCanvasY("game",object.x,object.y))

  • another way is to use the pin behavior and pin the yellow circle to the player.

    Everytime you are moving the circle on its own you disable the pin > do what ever movement you want > and repin it.

    something like this

  • Not sure that's a good idea, because if its on the game layer you will need to send it to the top with every new object you spawn on that layer and if you going to scale in/out the game layer, you'll probably want the crosshair to stay the same size, not to mention it's unnecessary extra events and behaviors.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks! Will try

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)