is there a better collision limiter?

miketv

  • Posts: 42
Is there a better way to prevent multiple collections? The "timer" method mentioned in a few threads (preventing collisions until after x seconds) just isn't cutting it for this game.

As my character (Gary) moves through the level at various speeds, collectible actors are randomly spawned & they all have different effects on Gary. Even though Gary is set up to kill the last collided actor, sometimes the collision will be detected multiple times instead of just once...which causes obvious problems. ( I have counters on the HUD to keep track of the collisions, & I've actually seen it rack up more than 20 hits on one collision, just because of the low speed he was traveling at the time)

So I added the timer. I can set the timer so Gary can't collide again until x amount of time has passed, but there's no guarantee that he won't encounter another one of those collectibles in that time.....which could be a total ripoff to the player. He could go right through a much-needed collectible without detection just because enough time hasn't passed.

Is there a better way to make 1 collision = 1 collision?

« Last Edit: September 02, 2012, 11:12:40 pm by miketv »

Innes

  • *
  • Posts: 1960
If a collectible should only be collected, once then then get the collectible to do the collision management. i.e. give the collectible a boolean, such as 'collected' and set it to False and when it collides with player set 'collected' to True so it can't be collected again.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

miketv

  • Posts: 42
won't that require a timer to to reset it to 'false' so the next one can be collected?

(side note, I noticed that putting the 'kill self' tag in the collectible kills ALL copies of that collectible....so I'm keeping that one in the player/actor's events)

rob1221

  • *
  • Posts: 9472
If "kill self" is killing all actors of that type then you're probably using the type/type (or group) collision event rather than the actor/type collision event.

miketv

  • Posts: 42
ok....but won't the above method require a timer to reset the value to 'false' so the next one can be collected?

rob1221

  • *
  • Posts: 9472
What value?  You don't need a boolean to limit collision if the actor kills itself on collision.  Besides, actor attributes are specific to each actor, not type.

miketv

  • Posts: 42
thanks, Rob1221....that was the info I needed. This is my 1st attempt at programming, & I still don't get some of the finer points. I WAS using the type/type collision instead of actor/type.
I've tested & tested, & I can longer get multiple collisions on a single hit.

Mesket

  • Posts: 33
I'm having the same problem.-

Getting my projectiles hit multiple times a single target.

Funny thing is, I have it working properly using a timer to reset a boolean to check collision only once, but when I duplicated the actor to produce another type of projectile... even though it has EXACTLY the same events set up, it behaves differently producing decens of hits in a single hit.


Edit: This is getting weird... I'm calling the exorcist.

Both my "Laser" and "Misil" are clones of each other. I created 2 collision groups which are also clones (shape, size, who collides which whom)... BUT the misil just want to collide million times on a single hit  :'(


Edit 2: I'm definetely calling a priest... I just checked, save, and unchecked "What kind of actor?" from normal to cannot be pushed and now it works... Stencyl works in mysterious ways! but glad it's working now.

« Last Edit: March 03, 2013, 04:27:32 pm by Mesket »