register distance from start
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
i was wondering if there was a feature to do this.
thx
Comments
elaborate on what you mean?
I want to make a distance counter like iCopter!! PLEASEPLEASEPLEASE!
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
http://gamesalad.com/game/9669