The Daily Click ::. Forums ::. Klik Coding Help ::. argh!! this is so frusterating....
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
13th August, 2009 at 06:47:00 -

well, i have an enemy that bounces around and runs into and what not, but im using the pinball movement for him to bounce (cause its simple and stuff...) anywho, he gets stuck in walls and moves slightly when i move, obviously this is a default movement flaw, as they all have flaws... so i suppose my question is, is there a way to fix said flaw, or do i have to make a custom movement, and if so, i need an example because i have no idea how to make a random bounce movement with gravity applied.

thanks in advance.

 
[Game design makes my brain feel like its gonna explode.]

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
13th August, 2009 at 12:20:23 -

I have just the thing. Recently made a quick example of an embedded collision detector and static engine on another post for items drops off bad guys. my example will show spinning fruit and coins that appear and bounce around after you click the diamonds.
Whole thing was written basically for the sake of avoiding pinball movement's collision issues.
most the code should be rather copy pastable:
http://www.mediafire.com/download.php?al5jdnzv4xz
Note, made in mmf2dev.


 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
13th August, 2009 at 22:35:25 -

thanks a ton! i shall have edit it a bit so they dont stop bouncing but it works, thanks!
and on another note i managed to get the pinball movement to work a bit, but if 2 bouncy chain guys hit a wall at the same time they will fall through them, oh well lol, i tried

 
[Game design makes my brain feel like its gonna explode.]

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
13th August, 2009 at 23:48:55 -

wlel, the slow down effect is caused by a coefficient of restitution. you'll notice onthe bounce events it says like;

set xInertia to '(0-xInertia)*0.5'

this flips the direction on the x axis and the 0.5 there sets it's speed tohalf of what it was when it hit the wall. delete the *0.5 bit and bounces wont slow it.so simply:
set xInertia to '(0-xInertia)'

I think there's also an x value slowdown inthe intital always loop to mimic drag, something like,

always set xInertia to xInertia *0.99

to gradually slow it, remove this to slow horizontal slowing.

There's also a few 'catch' events there that completely stop it if it gets too close to zero, they probably wont be necessary if your objects aren't going to slow anyway.


 
n/a
   

Post Reply



 



Advertisement

Worth A Click