Anchor in center

0 favourites
  • 8 posts
  • Hi guys,

    I was surprised to find that anchor behaviour can not center the HUD without scaling it.

    Whats the best way to position HUD element in bottom center for example, in multiple screen sizes?


  • Can anyone help?

  • I'm also looking for this, it seems pointless to have the other anchor options without the ability to set my main game window to the middle (I don't want it to change size, would affect gameplacy).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When I wanted to centre a element to screen I set it's position to X: (WindowWidth/2) - (Self.Width/2) and Y: (WindowHeight/2) - (Self.Height/2) and you can attach it to a layer that has zero scaling set, it will be the same size across all displays.

    I use Self.Wdith/2 because my origin for the element is in the centre, but if you moved it to top left for example you don't need that.

  • Well, this works if you don't use Anchor

    If you do use it you cant move the sprite.

    I think the anchor behavior should be tweaked

  • I have experimented with setting positions at startup, but unless I am missing something this just breaks if you resize the window e.g. in a browser.

    I don't really want to have to code two versions of the same game for mobile and PC.

    C2 has so much potential I am surprised by the holes in layout options. There should be support for multiple layouts (mobile port, land), and support for "window resize" event.

  • Hello this problem was solved?

  • you can have an event that re positions it on every tick. make an invisible sprite called "center" then it will always remain in the center if you use the the position code as stated above, and you can align other objects to it as necessary.

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