so i came up with an idea for a little game (FINALLY!)
and i wanted to do 360 shooting...and then i forgot how lol.
i been looking for tuts on doing it in tgf but the one i used way back when that worked so perfectly doesnt seem to exist anymore. and i cant find it on any of my disks or computers. so i set out to do my own. i used basic trig for 360 degrees and the advanced math object but i cant seem to get it working just the way i want. its the stupid offset that i dont know exactly when to divide and when to multiply by.
so if anyone can help a fellow out, id love an example that uses the advanced math object and trig, cause i want to be able to tune it once i get it.
please and thank you!!!
n/a
Dustin Gunn Gnarly Tubular Way Cool Awesome Groovy Mondo
Registered 15/12/2004
Points 2659
10th February, 2008 at 10:39:38 -
I recommend just using trig for something that simple.
It's really just as easy as this:
Set x position to x position + cos(angle) * distance
Set y position to y position - sin(angle) * distance
i dont think you can just use trig like that in tgf. thats what the advanced math object is for. and the offset thing is a bitch.
its not the trig i have a probelm with. thats the easy part.
anyway i found an example on a backup disk of mine. its not exactly what i want, but i think itll do. oh how i wish for mmf2.
You can't! Or at least I haven't seen it done. If you toss the trig formula like that, MMF is gonna turn the cos(angle)*distance into integers, which doesn't work for small numbers, like if distance was set to 1. If you can turn it into a float, it should work fine, but I'm not sure if TGF has that. I scrapped another project just because of this problem.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
You can use values to account for the decimal values, thus avoiding rounding errors
Upon the object being created (no such condition exists, you'll have to insert it into the same event in which the object is created)
- set vale A to x coordinates
-set value B to y coordinates
Always
- add to value A: cos(angle) * speed
- add to value B: sin(angle) * speed
- set x coordinated to vale A
- set y to value B
i dont know if id use it enough to want to buy it. thats why im holding off. i would totally buy mmf1.5 if it were still available.
ive seen tgf do the trig. i just dont remember how and couldnt find the example that used to be up on here. i even made a nice 360 shooting engine but i never backed it up and it got lost in a computer crash.
Hi Cecil, I've just found an old rotation example I made in TGF using Advanced Math object. It's basically sin/cos as Dustin explained, with an extra variable (Global Value 1) used for acceleration/deceleration on the rotation. I don't have TGF installed anymore but if you have the Advanced Math Object and TGF1.6 it should work.
will...you be my....valentine? jk. i dont roll that way. unless your a chick then yes i do
anyway. thanks nim. that looks mighty handy. if i can get it to work well to angle with the mouse using that method, then ill definitely be using it. btw dont use mouse control objects in tgf. it screws with normal mouse function. other than that. thanks much.