move to coordinates
I am trying to make it so that when the player collects a coin, it flies up to the area in the HUD that is keeping track of the number of coins collected before disappearing.
I have tried a move to behavior and inputted the coordinates of the HUD element. Problem is, when the coins are touched, they fly to where the HUD element was at the beginning of the stage.
Anyone know how to account for the change? or have them fly to the coordinates of the screen rather than the world?
I have tried a move to behavior and inputted the coordinates of the HUD element. Problem is, when the coins are touched, they fly to where the HUD element was at the beginning of the stage.
Anyone know how to account for the change? or have them fly to the coordinates of the screen rather than the world?
Comments
Try interpolate behavior. Put all the coins where they will end up in the game, and write down their X and Y cords. Then, put them in the level where ever you wanted them, and use the interpolate behavior.
e.g:
Interpolate: self.Position.X to: 715
Interpolate: self.Position.Y to: 196
Hope this helped
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I guess the HUD elements coordinates never change since they are not on a scrollable layer. Do they have some kind of screen coordinates I could use instead of the world coordinates it was assigned?
I used your solution that you first suggested for this uptimistik.
As you can see, the coins are being interpolated to the x/y position of the HUD coin counter in the center where you will notice it counting up. But they are flying to the position where it was right at the start of the level. and since the HUD is non scrollable, the coordinates never change, they just stay at the beginning of the level.
1) Create the HUDX and HUDY global variables as you suggested.
2) Double click an item on the HUD layer and unlock (creating an instance). Constrain HUDX/Y globals to the (Camera.Origin.position.X/Y + game.Counter.position.X/Y). This puts the coordinates where they should be in relation to the camera to deliver the item to the HUD counter.
3) Interpolate just as you suggested.
And thank you uptimistik, I used your idea of shrinking the coins as they get to the destination combined with this solution. The results are better than I had in mind.