The Daily Click ::. Forums ::. Klik Coding Help ::. Simple Verlet / Puppet Strings Method?
 

Post Reply  Post Oekaki 
 

Posted By Message

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
8th April, 2010 at 02:01:39 -

I dunno dude ... I've been experimenting with it and ... this MMF2 interface is giving me a headache ... I can't even figure out how to make a spaceship move in 360º with realistic thrust.
All I can find is some "spaceship" scheme in an extension (bleh) that works like Oddro (not at all what I was trying to do).

I can probably get past the rotate the sprite problem in TGF1 by using a seperate active and moving its position around the character in a circle then tell the character to look in its direction really ... I just wish there were a more elegant solution.

Anyway, so far in MMF2 I have a spaceship that rotates the angle left and right by pressing a or d.
It also can shoot, but the odd thing is that when I set the direction it is to be shot towards as the angle of the spaceship, it's quite off. The action points and hotspots are all aligned, I just mean that it rotates the shooting angle faster than the spaceship angle. This is clearly because there are only 32 directions and it limits the bullet angle shot in because of that.
(clearly just having 360 directions to work with instead of 32 would make things much much much easier)

Now I'd like to figure out how to move it forwad with thrust based upon the angle but I haven't gotten a clue.
If this gets solved, then I could just do the same thing for shooting.

Edit: I bet if there were 96 directions (or maybe even 64), then most everyone wouldn't even need to bother with 360º custom movements.
just those extra directions would probably make it smooth enough.


Edited by MBK

 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
8th April, 2010 at 16:59:41 -

Your going to have to make a custom engine.

a 360 degree movement engine.

You can either use the Advanced Direction Object which is easier to use.

Or just trig, then you don't need an extension.

Create three new Alterable Values for the ship and name them:

ShipX
ShipY
Speed

Then do this:

Start of frame-
Set ShipX("ship") to X("ship")
Set ShipY("ship") to Y("ship")

On ThrustButton- (This is whatever you want to make it accelerate, you can change 8 to whatever you want the max speed to be, and 1 to whatever you want the rate of acceleration to be)
Set Speed("ship") to min(Speed("ship")+1,8)

On NOT ThrustButton- (Whenever the user let's off the ThrustButton it decelerates the ship)
Set Speed("ship") to max(Speed("ship")-1,0)

Always-
Set ShipX("ship") to ShipX("ship")+(cos(angle("ship"))*Speed("ship"))
Set ShipY("ship") to ShipY("ship")+(sin(angle("ship"))*Speed("ship"))
Set X position of object "ship" to ShipX("ship")
Set Y position of object "ship" to ShipY("ship")

There, a simple 360 degree movement engine with acceleration. You might need to tweek the numbers for it to work well though.

WHOOPs forgot rotations!

On Left-
Set Angle("ship") to Angle("ship")+2

On Right-
Set Angle("ship") to Angle("ship")-2

Blah!

Edited by UrbanMonk

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
15th April, 2010 at 02:43:45 -

Thank you much guys, especially UrbanMonk
I'm still a bit stumped at the math, but it's slowly sinking in to my thick head.

There's one thing regarding the swinging object which makes it harder than the spaceship in a way, and that's gravity acting upon it as the weapon spins round the hotspot/action point ... I'm still clueless on that so I guess just changing the direction or adding/subtracting to the angle will have to do for now.

Thank You All!
I may need more help with it later, so try not to get too mad at me if/when I ask again.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
15th April, 2010 at 04:25:08 -

I won't be mad.

 
n/a

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
15th April, 2010 at 18:32:45 -

Just pointing out that UrbanMonk's example has more of a car feel to it rather than a spaceship. I'm not having a go at his example before anyone thinks that, I'm just saying x) Sketchy's useful formula article has the basics for creating an Asteroids style movement which I've used many times in the past http://www.create-games.com/article.asp?id=1898

 
There are 10 types of people in the world: Those who understand binary and those who don't.

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
15th April, 2010 at 21:45:35 -

Thank You for pointing that out Rob, I need all the help I can get.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
15th April, 2010 at 22:23:15 -

Yeah, it's a very simple 360 degree movement example, and wouldn't be for anything that uses angular momentum.(If that's even a term. )

 
n/a
   

Post Reply



 



Advertisement

Worth A Click