How do I "pin" text over my character

  • Hi everyone,

    I want my game to display the fuel units on top of my character. I created a text object, and in the event page I wrote it like this:

    Every tick > set "text" position to "Player"(imagepoint 3)

    Every tick > set "text" to (Global Variable, in this case fuel_units)

    If you go to the pictures you'll see that this display has no problems when stuck to the layer, but apparently when following an imagepoint, after my Player falls for a few pixels then the text falls too, and faster than my character (see picture).

    I don't know why this happens considering I used the same every tick > set "SPRITE" position to "PLAYER"(imagepoint 2) and it works, so how come the text falls?

    BTW, I tried using the PIN behaviour and it didn't help.

  • Did you check to see that your imagepoints are running through all of your animations?

    so lets say if your player jumps and you have imagepoints on the jump

    and you want the text to follow on the fall animation then you need to apply the imagepoints to that animation.

    rightclick imagepoint - apply to all animations

    if the imagepoints are not set then the default position goes to the orientation point which im assuming is below your player.

    hope this helps

  • jaypeps81 it didn't for some reason it keeps on falling. I can't make it stay above my character as he falls through the stage. It keeps falling faster than my character.

  • PixelBoss

    Would you be able to share your capx, or recreate the issue in another capx so I could take a look at this issue for you.

    I created my own player sprite and set text to image point and it worked perfectly. I couldn't recreate your issue.

  • I'll pm you the link as soon as I have it ready. Thanks.

  • Welp, looks like I can't send you a PM. Here it goes.

  • Hah. Can't even post URLs. I guess I'm S.O.L. for now.

  • Just add a few spaces to "break" the URL.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • url deleted

    Let me know if it works.

  • Worked. Your text is on the UI layer, which has a different parallax to the Game layer. Change the text to Game, and it works.

  • blackhornet omg, it works now!

    Coud you elaborate more on why this happens please?

  • The point of parallax is to have objects scroll at different rates. At the top of the layout, scrolling doesn't kick in yet. Once you start moving down, then positions are recalculated internally by C2 to account for the different position scaling of each layer. You need to keep things that are meant to move together on the same layer (or on a layer with the same parallax values),

  • Gotcha. Thanks for the mini lesson blackhornet I owe you one.

  • you could do it like so

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