The Daily Click ::. Forums ::. Klik Coding Help ::. coin drop
 

Post Reply  Post Oekaki 
 

Posted By Message

badm1nton



Registered
  01/02/2009
Points
  14
4th August, 2009 at 21:17:04 -

Hi,
im working on a platforming game and i want to make the enemies drop a few coins when they die.
i'd like them to bounce around a little bit before stopping, so they might hit a wall or a ceiling a couple of times.
problem is, im not sure how to make a really simple collision system for these coins.
the one im using for the character is quite complex and im not sure i can replicate that same system for each coin.
any help will be greatly appreciated.

 
n/a

MrPineapple

the fruitiest word i know

Registered
  14/10/2008
Points
  1449

VIP Member
4th August, 2009 at 22:26:12 -

if you're desperate there's always the pinball movement, although they might get stuck in walls and stuff occasionally.

 
i am STILL a talking pineapple!

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
4th August, 2009 at 23:36:28 -

The best would be the embedded collision detector system. basically, you have a bonus animation on your coin, and in the 4 directions you put a block, pixel, line, which ever you want which is paced at the left, top, bottom and right side of the coin (relative to the hotspot). Then, you do:

*always

-coin animation = collision
-coin direction = right
*coin is overlapping backdrop?
+coin is moving right
-bounce left
*always
-coin direction = down
*coin is overlapping backdrop?
+coin is moving down
-bounce up
*always
-coin direction = left
*coin is overlapping backdrop?
+coin is moving left
-bounce right
*always
-coin direction = up
*coin is overlapping backdrop?
+coin is moving up
-bounce down
*always
-coin animation = coin


So it flicks through each of the collision frames and checks them against the background.

Edited by MrMcFlurry

 
n/a

badm1nton



Registered
  01/02/2009
Points
  14
6th August, 2009 at 00:26:52 -

cool thanks, i think i can get that to work.

 
n/a

Sergiocarp



Registered
  24/05/2009
Points
  294
6th August, 2009 at 04:26:32 -

Here you get an example that I make, I do not understand very well because the English is not my original language. I hope that whatever you ask.

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

 
__________________________________

www.mmfzone.com (para miembros que hablen espaņol)*(for spanish members)

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
6th August, 2009 at 04:40:33 -


Originally Posted by Sergiocarp
Here you get an example that I make, I do not understand very well because the English is not my original language. I hope that whatever you ask.

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



Obviously the simplest solution from a coding point of view, but as Mr Pineapple said, coins might get stuck in walls with pinball movement, the collision detector method is pretty much a lot safer.

Although, this in itself could be considered a very minor issue, so if you don't want to go into things like the static engine and want to use default movements, Sergio's example is best. Mine is more suited to Static movement engines (i.e. custom position setting etc.)

 
n/a

DMT



Registered
  18/06/2009
Points
  150
6th August, 2009 at 17:24:08 -

Pinball Movement Works! Set the speed low and default moving upwards. Then add an event that
+Alterable Value A of Coin<5
+coin collision with Backdrop
Then
Coin-> Bounce
Coin-> Add 1 to Alterable Value A

+Alterable Value A of Coin=5
+coin collision with Backdrop
Coin-> Bounce
Coin-> Stop

Simple!

 
I am no longer not a taco.

badm1nton



Registered
  01/02/2009
Points
  14
9th August, 2009 at 00:13:27 -

sorry MrMcFlurry, do you mind making an example ?
i tried to do it, but the coin keeps flashing as it goes through the bonus animations.

 
n/a

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
9th August, 2009 at 05:49:35 -

http://www.mediafire.com/download.php?1jzemwntzwi
Here ya go, a small static engine, random obect selection on killing an enemy included too. The code also shows a fix for the animation problem embedded collision detectors causes (i.e. repeatedly stopping and starting the animation effectively freezes it on the first frame)

Though, an alternative method isto simply use an external detector, but that would require a loop. This is the simplest and quickest static engine method for multiple, single animation objects such as this that i can think of.

Although, if you aren't using a static engine, I would suggest going with the example sergio gave using the in built pinball movement.

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
9th August, 2009 at 06:13:52 -

If you look on sites like Sonic Fangames HQ, they defiantly have some very interesting tutorials that can help bridge the gap between simple tactics and more fun to work with techniques. For example, you could probably come up with a very interesting coin drop system by learning how to create proper ring spills off of one of their tutorials. Making a fangame may not be an accepted thing to do, especially around communities, however the knowledge you gain by trying to reproduce a professionals work, is generally priceless knowledge you wont miss having.

 
http://www.facebook.com/truediamondgame

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
11th August, 2009 at 08:04:17 -

Haha! I thought sonic fangames hq was long dead! It even still has the faster running method i did like, 8 years ago! Just when i was beginning to experiment with the static engine concept (http://www.sonicfangameshq.com/view.php?sec=4&id=7 lol)

Thanks for making me look it up

 
n/a
   

Post Reply



 



Advertisement

Worth A Click