Problem with a level collision event and recycled actors

rcpinto

  • *
  • Posts: 13
I'm having the following issue: in my scene I have a type-type collision event, which occurs when the player gets an item. I kill the item in this event. But then, the next time this item appears, the collision event doesn't trigger for it (it acts like a solid object and doesn't get killed). Then, when a third item appears (of the same type), it's okay again. If I let the item go without touching it, the next item (of the same type) is okay too, so it only happens after recycling. This cycle repeats. The event is attached (usually, I have a lot more blocks on this event, but the bug persists with only the kill block, so I think it's better to isolate the problem). By my previous experience with pure HaxeFlixel, I'd say it's something with the reset method. Maybe the listener is being removed from the recycled item or something like that?

If I use the actor event (for the item itself), everything works fine. But then, I'm not able to start a timer, because it gets killed together with the item, so I'm forced to use a scene level event.

I'm using 3.1 b7293 on Ubuntu 14.01 64bit.

EDIT: one more test: if I remove the kill block and leave the other blocks for the item effects, the item doesn't get killed (as expected in this case!), but the effects always happen, so the collision works normally if no recycling occurs.

rcpinto

  • *
  • Posts: 13
Anybody from Stencyl team can say something about this? Will you release a fix? Or can you just suggest some workaround? I'm depending on this to release my game.

rcpinto

  • *
  • Posts: 13
Do I need a Studio License to have my question answered here?

LIBERADO

  • *
  • Posts: 2636
 :) Hello!, I don't know the cause of your problem, but you can solve the issue of the timer using a boolean game attribute:

1º-Create a boolean game attribute called, for example, StartTimer

2º-In the actor event for the item, create this collision block:

                          when self hits a Player
                              kill self
                              set StartTimer to true

3º-Finally, in the scene level event, create this always block:

                         always
                             if StartTimer = true
                                    set StartTimer to false
                                    do after X seconds (the timer)
                                           etc...

« Last Edit: June 27, 2014, 07:09:50 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

rcpinto

  • *
  • Posts: 13
Thank you very much, LIBERADO, this workaround should solve my problem while there is no fix for the collision bug :)