Help with trajectory
![m456arcus](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hi,
I need some help with this one. I've seen something like what I'm going for in Mini Cannon (which is a great game btw). Anyways, what I need is an aiming system where the user touches a spot, which becomes the destination of the projectile which is thrown from a main actor. The trajectory should be a leisurely arc up then down. However, things might get complicated, because what I'm thinking is that if you touch then drag, it would be able to alter the trajectory. Just imagine drawing Bezier curves in Illustrator with the pen tool - that's what I have in mind.
Sorry if I missed this somewhere on the forums or the Wiki, but I've looked for a bit with no results other than sine and cosine, which I can't seem to modify to my liking.
I need some help with this one. I've seen something like what I'm going for in Mini Cannon (which is a great game btw). Anyways, what I need is an aiming system where the user touches a spot, which becomes the destination of the projectile which is thrown from a main actor. The trajectory should be a leisurely arc up then down. However, things might get complicated, because what I'm thinking is that if you touch then drag, it would be able to alter the trajectory. Just imagine drawing Bezier curves in Illustrator with the pen tool - that's what I have in mind.
Sorry if I missed this somewhere on the forums or the Wiki, but I've looked for a bit with no results other than sine and cosine, which I can't seem to modify to my liking.
Comments
___________________________________________________________________________________
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!! Now only $20
AppSolute Entertainment on Facebook
The only thing different from what I'm picturing is that in the demo, you don't actually pick the spot where it'll land. Maybe I should provide the context: the game is a platformer and this is a powerup. Like a Super Mario fireball, but instead of a fixed path you tap where you want the fireball to end up.
Now, take a rule, and make it so that "when mouse is down" "change attribute [targetX] to [game.Mouse.PositionX]" and "change attribute [targetY] to [game.Mouse.PositionY]"
In your missile actor, you can have it so that for the first second, it acelerates upward with a speed of 600. Then tell it to, after the first second, accelerate towards X,Y coordinates targetX,targetY with a speed of 600.
That's only theory. Right now, I don't have the time to test it, but I think it should work pretty well, if I understood you correctly.
Good luck,
~ Fang
Edit: Can't get this picture to show, but here's what I got:
constrain pos X to: (50*cos((self.Time*-180))+100
constrain pos Y to: (50*sin((self.Time*-180))+100