have a condition after an action

Forum Home Forum Home > Construct 2 General > How do I....?
 Post Reply Post Reply
Author
1,135 Rep
Post Options Post Options   Quote slot9 Quote  Post ReplyReply Direct Link To This Post Topic: have a condition after an action
    Posted: 16 Jun 2012 at 9:45am
For example I'd like to do a script like this

CONDITION: 'Pizza1' on collision with 'flooor'
ACTION: Wait 5 seconds
CONDITION: Pizza1 on collision with floor (check if it's been touching the floor for 5 seconds, 5 second rule ya know!)
ACTION: make 'Game_Over' visible!

Can I do this in one chain of scripting blocks without using variables?
Back to Top
7,817 Rep
Post Options Post Options   Quote zsangerous Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jun 2012 at 12:18pm
hmm why you don't use variable?? with variable it would be easy...

anyway i think this work :
condition 2:pizza1 collision with floor
           -> time >= 5 seconds        : make game_over visible
           -> time < 5 seconds        : make game_over unvisible
Back to Top
2,317 Rep
Post Options Post Options   Quote jimand Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jun 2012 at 2:31pm
All "wait" does is pause the system for a given period of time and then go to the next action, whatever it is. Obviously, you want the player to be able to take action, removing the pizza from the floor before the five seconds is up. I think each pizza instance needs an instance variable that increments by one for every second that the instance is touching the floor, and when that variable hits 5 for any pizza instance, the game is over. If the player removes the pizza instance from the floor, the instance variable needs to be reset to zero for that instance. The "wait" action is not needed.



Edited by jimand - 16 Jun 2012 at 2:44pm
Back to Top

Scirra Developer
84,479 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jun 2012 at 4:00pm
I think the OP wants to use sub-events. You can add a whole other event with conditions and actions that runs after the previous event's actions.
Back to Top
1,135 Rep
Post Options Post Options   Quote slot9 Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jun 2012 at 7:22pm
Thank you Ashley! Perfect!!!! This is a huge breakthrough for me
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down