Stopping continuous collisions

Hello again community! My work is well underway and my game is almost 1/2 of the way finished! Another problem though. If I want stencyl to register collisions once, what should I do? For example when two actors of a group collide I want them to increase a score, when that score reaches a certain amount the level passed event triggers. What is currently happening (with the code below) is that once one group makes a collision, it is registering as multiple collisions and the event level done happens even though the player hasn't really made the score requirements.  Thanks ahead for any and all help!

:)

corbanwolf

  • Posts: 223
It would be just easier if you put code for increasing player score in just the behaviour of actor of type instead of a scene. You would have to copy all events across scenes if you keep doing it that way.

You can increase the score in the behaviour of the square whenever they snap with another. And to register it only once you can do this:
http://community.stencyl.com/index.php/topic,56181.0.html

Well. Actually you have already done somethings similar before
♪♪♪♪♪♪

It would be just easier if you put code for increasing player score in just the behaviour of actor of type instead of a scene. You would have to copy all events across scenes if you keep doing it that way.

You can increase the score in the behaviour of the square whenever they snap with another. And to register it only once you can do this:
http://community.stencyl.com/index.php/topic,56181.0.html

Well. Actually you have already done somethings similar before

Like below right? It's not increasing score (level is not being passed)

corbanwolf

  • Posts: 223
Well. It should work. Apparently collision doesn't occur or cancolide is always false.

You know how to use collisions and you know how to you use IF statements and attributes. That's all you need to make collision occur just once.  The way I showed above works. And makes code being executed only once at the continuous collision.
♪♪♪♪♪♪

Vaibhav Sangwan

  • Posts: 161
make a boolean attribute and when collision takes place
if "boolean attribute"
set "boolean attribute" to false
do after ____ sec
set 'boolean attribute" to true
Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated

make a boolean attribute and when collision takes place
if "boolean attribute"
set "boolean attribute" to false
do after ____ sec
set 'boolean attribute" to true

Could you clarify a bit? Is what you suggested here different from my code above?

Well. It should work. Apparently collision doesn't occur or cancolide is always false.

You know how to use collisions and you know how to you use IF statements and attributes. That's all you need to make collision occur just once.  The way I showed above works. And makes code being executed only once at the continuous collision.

I think having the snappedamount=1 in the actor is not allowing the scene to recognize the code. Instead of the Boolean I tried just a straight up "If actors collide set snapped amount to snapped amount = 1" and nothing happened still.

Well. It should work. Apparently collision doesn't occur or cancolide is always false.

You know how to use collisions and you know how to you use IF statements and attributes. That's all you need to make collision occur just once.  The way I showed above works. And makes code being executed only once at the continuous collision.

I also tried with custom event, but an error doesn't allow me to do that.

corbanwolf

  • Posts: 223
The most obvious guess would be that some symbols aren't allowed in names
♪♪♪♪♪♪

JeffreyDriver

  • Posts: 2262
Corbanwolf is right. Letters and numbers only. No special characters or spaces.