Many actors, how I separate events triggered by their collisions after time?

Almakos

  • Posts: 632
Hi,
I have a grenade which explodes in 2 seconds after collision. When there is single grenade, everything works as expected, but if I throw several, they start colliding and then things break (I get infinite explosions, some never explode, etc.).
I need to treat each grenade separately, but have no idea how to do that in Stencyl.
I think I need to create some sort of array (List Game Attribute?) dynamically filled with grenades, so I know which one and when should explode...
But I don't know where to start.
Any help appreciated.
Fishing Fantasy Trailer


captaincomic

  • *
  • Posts: 6108
I think it might work better if you use normal attributes instead of game attributes for Collided and Coordinates. Then you wouldn't need a list, because every grenade actor has his own behavior with his own local attributes.

Almakos

  • Posts: 632
I made Coordinates globally available, because that is the only way I've found to tell to behavior about something that happened in other behavior. Probably I didn't need to do that, but for some reason it is what it is =)
If that is my problem, I will try to fix that, thank you.
Fishing Fantasy Trailer


captaincomic

  • *
  • Posts: 6108
Oh, I didn't notice that this was two separate behaviors. Yes, to share attributes between behaviors you need to use game attributes or the "for <self>, get _ from behavior _" block.

In your case, it might be easiest to put the "Boom" event in the other behavior, so that you only have one behavior.

Almakos

  • Posts: 632
Ok, I will try. I don't feel comfortable enough around all this stuff yet, so am doing things not the right way, but the way I can get it to work. Obviously there are a lot of conflicts happen on the way. I think I've got the idea what to try next. Thank you.
Fishing Fantasy Trailer


Almakos

  • Posts: 632
Awesome!, everything resolved when I merged behaviors and used local attributes =)
Thanks again for help.
Fishing Fantasy Trailer