GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do I get the money to move with the character?

Applesauce NinjaApplesauce Ninja Posts: 13Member
edited December 2014 in Working with GS (PC)

I need help getting the money score ($) to move with the character. I am making a game similar to hill climb racing and the character works, so does the money. The scene is H-720 and W-10,000 if that helps. I know the $ needs to move on the x axis with the characters x axis. Can you leave a comment telling me how to do this?

Comments

  • The game is on my website, applesauceninja.moonfruit.com go to my games, then One-Wheel Drive. Not trying to advertise, just trying to get help.

  • tatiangtatiang Posts: 11,844Member, Sous Chef, PRO, Senior Sous-Chef

    There are a couple of ways you could do this but the easiest is just to put a Display Text behavior in the actor and have it display the amount of money/score. You can offset the position by changing the x and y values relative to the actor in the Display Text behavior.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • That makes complete sense! Thank you!

  • @tatiang‌ Now that I try it, I'm not sure how to change the x and y of the display text behavior. Could you tell me exactly how to do this?

  • @tatiang‌ I have the character displaying the money/score but it's displaying it on the character. I'm not sure how to change the x and y of the display text behavior.

  • SocksSocks London, UK.Posts: 12,822Member
    edited December 2014

    @Applesauce Ninja said:
    tatiang‌ I have the character displaying the money/score but it's displaying it on the character. I'm not sure how to change the x and y of the display text behavior.

    I'm not sure whether the PC version of Creator has text position offsets as yet (?) but if it has simply enter a value other than 0.

  • Applesauce NinjaApplesauce Ninja Posts: 13Member
    edited December 2014

    @Socks said:
    I'm not sure whether the PC version of Creator has text position offsets as yet (?) but if it has simply enter a value other than 0.

    Pc version does not. What if I took my project and offset the text on a Mac gamesalad. Would the pc version work with it when I edit it in the pc version?

  • SocksSocks London, UK.Posts: 12,822Member

    @Applesauce Ninja said:

    Pc version does not. What if I took my project and offset the text on a Mac gamesalad. Would the pc version work with it when I edit it in the pc version?

    No ! :smile:

    If you simply want one actor to track the X position of another you can simply constrain the following actor's X position to the leading actor's X position using a constrain behaviour.

  • Ok I'll try it

  • SocksSocks London, UK.Posts: 12,822Member
    edited December 2014

    @Applesauce Ninja said:
    Ok I'll try it

    Make a game.attribute ('real'), let's call it HeroX

    . . . . . . . . . . . .

    In the leading actor - place a constrain behaviour that reads:

    Constrain HeroX to self.x

    . . . . . . . . . . . .

    In the following actor - place a constrain behaviour that reads:

    Constrain self.x to HeroX

  • Applesauce NinjaApplesauce Ninja Posts: 13Member
    edited December 2014

    @‌Socks This is what I've done:

    Constrain Attribute
    constrain: self.position.x to: __________

    What do I put in the second blank? Did I put the correct thing in the first blank?

  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,549Member

    It looks like in hill climb racing the money count is part of the GUI, if you are asking how to create a non-moving GUI for a scrolling game, this video might help:

  • SocksSocks London, UK.Posts: 12,822Member

    @Applesauce Ninja said:
    @‌Socks This is what I've done:

    Constrain Attribute
    constrain: self.position.x to: __________

    What do I put in the second blank? Did I put the correct thing in the first blank?

    Make a game.attribute ('real'), let's call it HeroX

    . . . . . . . . . . . .

    In the leading actor - place a constrain behaviour that reads:

    Constrain HeroX to self.x

    . . . . . . . . . . . .

    In the following actor - place a constrain behaviour that reads:

    Constrain self.x to HeroX

  • Applesauce NinjaApplesauce Ninja Posts: 13Member
    edited December 2014

    @Socks @jamie_c‌ Thank you both, its working! Just have to do a little more work

  • you could try constraining the position of the player XandY then have the health display move to the attribute it is constrained to

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    @Stop Sign Studios Inc. said:
    you could try constraining the position of the player XandY then have the health display move to the attribute it is constrained to

    That was already shown above.

Sign In or Register to comment.