Making a set of objects stay fixed in the viewport

  • Hello! I'm currently building out a game for a class of mine and have run into a bit of a snag.

    I need to be able to get a few elements that will eventually be used as UI elements to stay in fixed positions as the Viewport is set to "scroll to" the submarine in the photo below

    imgur.com/gallery/Cwno3E9

    I need these elements to be in fixed positions and move relative to the position of the sub as it moves through the layout such that when the player moves the elements in question will move with the player.

    Thanks!

  • Many ways to do it but the easiest might be pin behaviour, apply pin behaviour to the objects, pin them to the submarine in their starting positions and they will move with it.

  • Many ways to do it but the easiest might be pin behaviour, apply pin behaviour to the objects, pin them to the submarine in their starting positions and they will move with it.

    I'll give it a try! I was looking around earlier for behaviors that might work and the Pin behavior was one of those that caught my eye! Thanks!

  • It should work but it might not be flexible enough for what you want. If not, then post back in here, there will be tons of ways such as setting the value of the objects to submarine+/-x,y, or I think you can put the UI items into a layer with parallax set to 0,0 which means they never scroll.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, so that idea worked however since the submarine in my game has pitch control as well as up/down and forward/reverse, the pinned element just follows the changing orientation of the submarine.

  • When you pin it to the sub, select 'position', not the default 'position and angle'.

  • It sounds like you just want a static interface, yeah? Put all of the UI elements in a separate layer with parallax 0,0 and set the layer higher than the other layers containing the player and game elements. Then add the anchor behavior to your UI elements. That should work fine.

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