Making a collision bounce straight up.
adecker
Member Posts: 10
Ok so, i am making a game for iPhone like this one here: http://www.ferryhalim.com/orisinal/g3/bells.htm
I have tried everything i know how to do with collisions, but no matter what it shoots the actor in off the way where the collision happened. Any help anyone could provide would be nice!
I have tried everything i know how to do with collisions, but no matter what it shoots the actor in off the way where the collision happened. Any help anyone could provide would be nice!
Comments
In that rule (which fires upon collision), add a "Constrain" behavior to constrain the actors "X" position (i.e. self.Position.X) to the current value from the same value. So you may need to save it to an attribute first and then constrain it from the attribute value (if you constrain the self.Position.X to itself, you probably won't get the effect you want and you will be buring CPU cycles for no reason).
You could then un-constrain upon some other event (i.e. just set it back to a value rather than using another constrain).
Hope that made sense.
Be aware that this method will force a straight up movement after a collision and its perceived speed may vary a little based on the original angle of deflection of the collision before being constrained.
If you alter the velocities as above, you probably won't even need to mess with the X position (i.e. no need to constrain it).
Sorry, it's hard to remember all this when you are on a non-Mac at work and don't have GS in front of you to peek at or mess with.