The Daily Click ::. Forums ::. Klik Coding Help ::. Bouncing coins
 

Post Reply  Post Oekaki 
 

Posted By Message

Kottis



Registered
  20/07/2010
Points
  11
18th August, 2010 at 03:08:42 -

I think that this is probably really simple, but for the life of me I can't seem to figure it out right now. I am trying to make a chest that will lob out coins when opened.

My problem is that I can't get the coins to behave correctly. I need them to first shoot out in some random upwards directions, then fall towards the ground (bouncing off any walls they hit) and of course stop when they hit the ground. Maybe bounce a couple of steps before stopping completely, but that's not strictly necessary. And preferably without using detectors.

Sort of something like from 00:40 in this clip, except that it would decelerate and stop after a while on the ground:
http://www.youtube.com/watch?v=8T2ZLFMCpfk&feature=related

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th August, 2010 at 03:22:00 -

Pinball movement is what you need! Set the initial direction of the coins in upward directions and you're good as gold!

Here's an example I cooked up: http://jollycrouton.com/Uploads/coins.zip

Is that what you need?

 

  		
  		

Kottis



Registered
  20/07/2010
Points
  11
18th August, 2010 at 11:03:43 -

Yesss, thank you, you're a champion! I knew it had to be something simple - I feel dumb now . It still has a problem with sometimes sticking to walls, but I can probably solve that.

Thanks again!

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th August, 2010 at 13:45:33 -

No problem!

It sticks to walls? What are you using for walls? Active objects?

 

  		
  		

Kottis



Registered
  20/07/2010
Points
  11
18th August, 2010 at 15:12:16 -

No, standard obstacle backgrounds - but I have managed to fix it using collision masks.

However, another really weird bug popped up, and I can't seem to kill it. Basically, the balls/coins sometimes doesn't bounce or stop when they are on a corner.

I made this example, can you have a look if you have the time? It would be much appreciated!

http://dl.dropbox.com/u/8425715/pinballbug.mfa

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th August, 2010 at 15:37:21 -

My non-expert gut says it's just an issue with the collision detection. The built-in movements are notorious for odd bouncing.

If you remove line 10, it happens very rarely. I think limiting the speed is keeping it from being able to escape the corner. But the bouncing is still weird.

Checking "use fine collision detection" seems to help somewhat.

 

  		
  		

Kottis



Registered
  20/07/2010
Points
  11
18th August, 2010 at 16:05:09 -

Aw dang it, the example doesn't seem to replicate the bug that happens without line 10.

Here's another to show what I meant:

http://dl.dropbox.com/u/8425715/pinballbug2.mfa

This shows the "shooting off at high speed" effect I was talking about.
Notice that it sometimes affects one of the coins hitting the left side too, but instead of shooting off it kinda hangs for a while and then drops.

I really am stumped on this! Maybe I should look into making some sort of custom movement, but it seems like such overkill for this simple effect...

 
n/a
   

Post Reply



 



Advertisement

Worth A Click