i am attempting to make a worms type game and am having a little trouble arcing the projectiles right. right now im using something like
-PL1 pressed fire 1
and ("projectile")<1
then shoot ("projectile") towards ("sight")
set Value A("projectile") to X("projectile")
set Value B("projectile") to 24
-X("projectile")>Value A("projectile")
and B("projectile")<>dir("projectile")
every 0'00''10'''
then set dir("projectile") to dir("projectile")-1
-X("projectile")<Value A("projectile")
and B("projectile")<>dir("projectile")
every 0'00''10'''
then set dir("projectile") to dir("projectile")+1
this works but not the way i had hoped. it arcs, but when you fire nearly straight up it doesnt go up, a little over, then down. it just does a huge arc-high and far. also if anyone knows how to make it the longer you hold the mouse the more power is stored up and then it fires when you release would be helpful.
I'd have a value for y direction and a value for x direction, when you angle upward make the y value greater than the x value, etc. And make both values higher as for more power. When you fire, create an object and make it move accross x amount and up y amount. Decrease y every so-often so the projectile stops going up and goes down.
Wow, you've inspired me, I feel like making a worms game now!
You can get the distance between an enemy and the player by using ABS(X("Enemy") - X("Player")) (this only takes horizontal distance in to account, obviously, and I'm not entirely sure whether MMF has an ABS function or the syntax of it) - how you interpret that distance and translate it in to an angle is up to you, though.
well im testing out ideas in TGF and ill upload it into MMF and start over with what i know works from there. but anything will help me at this point since im just starting. make suggestions if you fell like it.
If you want to get the proper (i.e. point-to-point) distance between two objects, just use Pythagoras Theorem:
Set 'X distance' counter to X player - X enemy
Set 'Y distance' counter to Y player - Y enemy
Set 'X distance' to the power of 2
Set 'Y distance' to the power of 2
Set 'Actual distance' counter to 'X distance' + 'Y distance'
Square root 'Actual distance'
...and that's it. If you're still using TGF, then you'll have to resort to the Advanced Math object. The decimal offset will need to be moved a few places as well (say, 10 to the power of 3), as TGF can't handle decimals.
The proper way to do arcing is by using sin and cos for 360 degree movement. Getting the right effect after that, however, is difficult. I presume. I haven't actually tried it myself =P. Maybe I can come up with something...
well i know how to do arcing with speed and time and trajectory in TI 83+ but thats calculator programming and it has perametric equations that use sin cos and tangents. is there any way to use perametric eqs. in tgf or mmf? if so then id be really happy. for some reason i do better using TI 83 programming then i do tgf and mmf events. theres just something about it.
also can you submit games to DC that arent made with clickteam products? just wondering
You can submit none clickteam apps, i've seen it many times. I dunno if you SHOULD...but you can...
you could always make a seperate event for shooting straight up, but hell, if i were you i'd ditch the timed events anyways and start from scratch using trig, I've never actually done that, I know trig but implementing it in MMF sounds too time consuming.
thinking is like pong, it's easy, but you miss sometimes.
*shrugs* no idea what I or J notation is. Call me biased (or plain ignorant =P) but I feel that there's no point confusing people when you don't need to. Explaining things in simple terms is better than presenting some equation that only makes sense to robots, or those who know how to do the calculation in the first place =P