Hi again!
After I've received such a great help with my last math problem, here is another one I encountered lately.
I want a gun to shoot a specific "path" without using any actual paths. It should be handeled with a simple math formula, but again, I suck at math!
The bullet should fly in a boomerangly way like this:
Right now I already made it shoot like this, but I use about 10 triggers to do so and it is inaccurate (looks like some math noob made some stuff that kinda looks like he is trying to be professional...)
Would be really great if someone could tell me a better way to handle this!
Hm, what you've got there is a sinus wave which changes direction with 180 degrees after half a period. I'm not sure how to program it, but that should give you a good start.
On shooting the boomerang, you would need to start a counter/value that increases up to 180. You would then set a flag on after it reaches this, and continue to increase it, but just simply change the X direction of movement.
Eg
Upon shooting
+ no boomerangs on screen =
Boomerang set flag off
Alt Value A boomerang = 0
Player: set flag on
Always
+ player flag on
= Alt value A boomerang + 1
Set Y position of boomerang to Y("hand position) + (max height of flight path)*(sin (Alt value A boomerang))
OR if MMF works in radians Y("hand position") + (max height)*(sin ((pi/180)*Alt value A boomerang))
Always + boomerang flag off
= Set X position of boomerang to X("Boomerang") + 1 (or however much you want it to increase by each step
Always + boomerang flag on
= Set X position to X("Boomerang") - 1
Alt value A boomerang > 180
Set flag boomerang on
OR SOMETHING LIKE THIS
i dont have anything to test it on, but that's a basic idea of how it works.
Originally Posted by Eternal Man [EE] Hm, what you've got there is a sinus wave which changes direction with 180 degrees after half a period. I'm not sure how to program it, but that should give you a good start.
Originally Posted by The Dominant and Heartless Drawcula
Originally Posted by Eternal Man [EE] Hm, what you've got there is a sinus wave which changes direction with 180 degrees after half a period. I'm not sure how to program it, but that should give you a good start.
I believe you mean, SINE wave?
Probably THE most annoying thing a person can do, but yes I meant SINE wave. It's called SINUS here in Sweden and should be called that EVERYWHERE ELSE since it's the original latin form of the word, but then it could also just be called JB derived from JIBA which is the older arabic word for the function or why the hell not just JIVA abbreviated from JYA-ARDHA which is the pure original sanskrit name for it.
SUCK to you for that.