register distance from start

gpoppigpoppi Member, PRO Posts: 47
edited November -1 in Working with GS (Mac)
i'd like to create a sort of score board under the active game like icopter , the game for iphone.
i was wondering if there was a feature to do this.
thx

Comments

  • ktfrightktfright Member Posts: 964
    can you a
    elaborate on what you mean?
  • gpoppigpoppi Member, PRO Posts: 47
    well, you know icopter?? well there is a sort of counter registering how far the helicopter goes from the start of the game. well id like to do something like that , is it possible??
  • xactoxacto Member Posts: 146
    Should be quite easy in GS. You could use a solid color actor and just increase its x or y value to match the distance of your map.
  • yoenoeszyoenoesz Member Posts: 42
    I wanna know this also! It could be easy but I can't figure out how to! Please help me somebody!

    I want to make a distance counter like iCopter!! PLEASEPLEASEPLEASE!
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    I've not played iCopter before but if you mean that you want a number saying how far away the Helicopter is from it's start position, all you would need to do is create a few things:

    Attributes:
    HelicopterX (Real)
    HelicopterY (Real)
    Distance (Real)

    Actors:
    Helicopter
    START
    DistanceDisplay

    Open up the Helicopter actor and drag in 2 constrain attributes and in the first one constrain game.HelicopterX to self.position.x and in the second one, constrain game.HelicopterY to self.position.y

    What this is doing is registering where your Helicopter actor's position is at all times.

    Next you need to work out how far away the Helicopter actor is away from the Start actor.

    This is simple; all you need to do is drag in a constrain attribute and constrain game.Distance to (here's where it gets a little confusing if you're new to GS math) click the down arrow to the right of the Insert Function text, then click Magnitude. This should bring up this expression:

    magnitude(x,y)

    What you need to do now is delete everything up to the ( so you get this:

    magnitude(

    Now, click the drop down button to the left of 'Insert Function' and add self.position.x then the minus key, then game.HelicopterX

    Now you should have this:

    magnitude(self.position.x-game.HelicopterX

    Add a comma, then these attributes:

    self.position.y-game.HelicopterY

    Your full expression will look like this when you add the final )

    magnitude(self.position.x-HelicopterX,self.position.y-HelicopterY)

    All your calculations are complete now... Easy :)

    The only thing you need to do now is add a display text function in to the DistanceDisplay actor and click the 'e' next to the text box and simply add game.Distance

    You're done now :)

    If you're really new to the whole attribute thing, when I say 'self' you just have to click the name of the actor in the attribute window.

    Hope this helps guys.

    Ace
  • simo103simo103 Member, PRO Posts: 1,331
    Also I think Codemonkey provided a great template that showed various features that might work for you:

    http://gamesalad.com/game/9669
Sign In or Register to comment.