Dumb question

Posted By: jenGs

Dumb question - 07/25/13 19:38

I am workin with gs since a4 but never got this problem.

I have a block in my level, that got hit 2 times by a ball.
This block has no while loop, because it is passive. The only thing attached is an event_impact event.
Now I want to remove this entity after the second hit (hits are counted in an entSkill. HOW do I do that without letting the engine whine about : invalidCall in event ...

Is it only possible to remove entitys in the "agressor" function.
if yes, this concept is stupid, because my ball entity has a lot of other stuff to do and the event function is very crowded allready.
Posted By: rayp

Re: Dumb question - 07/25/13 20:08

This should work.
Code:
void _ball_event(){
   my.hits += 1;
   if (my.hits > 2) my.skill2 = 1;   
}
Action ball(){
   my.emask |= ENABLE_BLOCK;
   my.event = _ball_event;
   while (!my.skill2) wait (1);
   wait (1);
   ptr_remove (me);
}

Greets
Posted By: jenGs

Re: Dumb question - 07/25/13 20:13

Thank you. I just forgot to put in the wait. Thank you for pointing that out. Sometimes I am stuck on the easiest things.

Case closed laugh
© 2024 lite-C Forums