Toss a ball in an arc?
I'm sure this is easy, but I can't think of a way to do it!
How do I make an actor toss a ball and have the ball go in an arc until it reaches a certain point on the screen (not the bottom)?
How do I make an actor toss a ball and have the ball go in an arc until it reaches a certain point on the screen (not the bottom)?
Best Answers
-
tatiang Posts: 11,949
If you search for "arrow" in GameSalad under New, you can find a good demo called "Beyond the basics." I used this for a golf ball in flight and it worked well.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
-
JohnPapiomitis Posts: 6,256
Im running out the door to eat right now, and can provide more help later. But off the top of my head sin and cos for an arc would be something like this.
Constrain self position x to -130*cos(self.Time*100%180)+offset
Constrain self position y to 130*sin(self.Time*100%180)+offset
The 130 represents the radius of the arc. The minus in front of the 130 in the x constrain is to make it to left to right instead of right to left. The 100 is the speed. The 180 represents the arc as a half circle(half of 360), and the offset is its starting position in the scene. The self.Time just represents a value that keeps changing to keep it in movement. It can be any changing value, doesnt have to be time. As soon as that value stops changing the actor will stop moving.
When i get back home ill help you more.
Answers
That is what I mean...like a monkey tossing letters into a basket.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
(bit random I know, but it's late and I've got square eyes from too much audio editing for my game).
Nice to see the forum being its good old helpful self.
Teamwork makes the dream work