How do I get an anchored object to be animated?

0 favourites
  • 6 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hi all,

    For my game I use some HUD objects that use the anchor behavior so they neatly stay in place wherever my character goes. This is especially handy with layouts that scroll as no HUD piece is left behind.

    For my dialogue box though, I want to make it so it quickly pops up as text starts to run, to give a less static feeling. I tried doing so using tween behavior.

    Because my object is anchored, it pretty much ignores the tween behavior and setting anchor edges differently just makes the box weirdly distorted. It's almost as if I have to choose between anchoring an object in place or having freedom to animate it. Is there a workaround to mix it up and mash the two results together somehow?

  • If you use Anchor because of scrolling, you don't really need it. Simply set parallax to 0,0 on the HUD layer and it will not scroll. You will be able to use Tween and other movement behaviors on it.

    Anchor is mostly used to support different screen sizes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the tip! Though now it scrolls along in the editor like crazy without having any fixed position on the screen nor in the game itself. Do I need to define the position and size of the object each time On Layout Start and tween all those properties when animating as well?

  • Try disabling "Parallax in editor" checkbox in layer properties. And then simply set UI objects position correctly in the editor, they should stay there in the game.

  • Try disabling "Parallax in editor" checkbox in layer properties. And then simply set UI objects position correctly in the editor, they should stay there in the game.

    Thanks for your help so far!

    Mmm the problem seemed to be that I had the Z elevation on -1 for this specific object on the HUD layer. This somehow ignores makes it ignore the not-scrolling-in-the-editor. But even now, with the 0x0 parallax and the object staying in place in the editor, when testing the game and scrolling sideways the object (the dialogue box) refuses to stay locked in the viewport.

  • I fixed it by pinning the dialogue box to the text that's being printed on top of it. It's a bit of a workaround but hey, if it works.. :P

    Thanks!

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