How do I Stop everything exept one game object

0 favourites
  • 10 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Hello game developers,

    I'm new to this Engine, and i'm working on a falling object kind of game, where some random objects are falling from top of the screen and our hero character is saving himself (bottom of the screen), so the main issue is whenever these falling objects hit the character i want everything to stop(that's when a score screen comes up) and hero character does a litter animation of dying or something. I've managed to stop the game by "set time scale to 0" but this makes the entire game to stop and after that nothing happens the animation that i want to play doesn't work. Please help me on this or if there is some way by which i can select all the falling objects in the game because that way i'll only stop these ones by setting their speed to "zero" (i tried this way but only the one which is colliding stops)

    Thanks, hoping to hear some answers from you guys ....Cheers !!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can set timescale for individual objects too (there's a event command for it), so you can have a cursor move on a menu while everything else stops completely during a pause.

  • You can set timescale for individual objects too (there's a event command for it), so you can have a cursor move on a menu while everything else stops completely during a pause.

    that's right but the thing is i'm not able to select all the objects in the game that are falling, otherwise, i would've done this, could you tell me how to select all the objects in the game that are falling (these are basically one object with random x value)

  • you can use "For each" loop on a particular object to iterate through every object. And in the loop, you test for an object is falling or not. This depends on whatever behavior you are using on the falling object. (What behavior are you using?)

    if such object is indeed falling, set object timescale to 1.

    See: https://www.scirra.com/tutorials/40/bas ... and-arrays for "for each" loop.

  • you can use "For each" loop on a particular object to iterate through every object. And in the loop, you test for an object is falling or not. This depends on whatever behavior you are using on the falling object. (What behavior are you using?)

    if such object is indeed falling, set object timescale to 1.

    See: scirra.com/tutorials/40/bas ... and-arrays for "for each" loop.

    sorry but it didn't work again it's doing the same thing it's only stopping the object that is colliding with the player( i want every instance of that object to stop),I've attached an image please check and see if you can figure out something that I'm missing here

    1drv.ms/i/s!ArKLPFZfiKg0gqht4j9Cm1rCOmN7Pw

  • The reason that only one object is affected is because in the event, you loop through smallenemy as a subevent. In the overlapping event, it is true only when a smallenemy collides with player, and only the ONE particular smallenemy will be picked in this case. Going through in the event further in for each, you will be looping through only that ONE particular smallenemy, not all of them.

    To remedy this, try "pick all" condition, placing it right on top of the event block that contains For Each.

    [quote:2vul3ulf]Pick all

    Reset the picked objects back to all of them. Subsequent conditions will pick from all instances again instead of filtering from only those meeting all the conditions so far. See How events work for more information on how instances are picked in events. Useful in subevents to start affecting different instances again.

    source: https://www.scirra.com/manual/124/system-conditions

    further reading: (see picking part here) https://www.scirra.com/manual/75/how-events-work

    additionally, knowing about UID (see UID section) might be useful in certain cases that require more complicated picking: https://www.scirra.com/tutorials/292/gu ... t-features

  • Use this method, amitkuliyal. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    https://www.dropbox.com/s/fgw67t9mqovdo ... .capx?dl=0

  • The reason that only one object is affected is because in the event, you loop through smallenemy as a subevent. In the overlapping event, it is true only when a smallenemy collides with player, and only the ONE particular smallenemy will be picked in this case. Going through in the event further in for each, you will be looping through only that ONE particular smallenemy, not all of them.

    To remedy this, try "pick all" condition, placing it right on top of the event block that contains For Each.

    [quote:j65nxapq]Pick all

    Reset the picked objects back to all of them. Subsequent conditions will pick from all instances again instead of filtering from only those meeting all the conditions so far. See How events work for more information on how instances are picked in events. Useful in subevents to start affecting different instances again.

    source: scirra.com/manual/124/system-conditions

    further reading: (see picking part here) scirra.com/manual/75/how-events-work

    additionally, knowing about UID (see UID section) might be useful in certain cases that require more complicated picking: scirra.com/tutorials/292/gu ... t-features

    okay so that's what i was missing, thanks a lot man for these many refferences also , really appriciate it <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • Use this method, amitkuliyal. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green" />

    https://www.dropbox.com/s/fgw67t9mqovdo ... .capx?dl=0

    thanks buddy

  • You're welcome, amitkuliyal. The method will also work on other events such as Physics based objects. It's all up to finding a way to disable the source.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)