How do I Stop everything exept one game object

Get help using Construct 2

Post » Sun Sep 04, 2016 11:25 am

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 !!!
B
10
Posts: 26
Reputation: 485

Post » Sun Sep 04, 2016 11:28 am

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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Sun Sep 04, 2016 11:32 am

LaDestitute wrote: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)
B
10
Posts: 26
Reputation: 485

Post » Sun Sep 04, 2016 11:57 am

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.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Sun Sep 04, 2016 12:38 pm

Message: amitkuliyal can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
TwinBlazar wrote: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.


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

https://1drv.ms/i/s!ArKLPFZfiKg0gqht4j9Cm1rCOmN7Pw
B
10
Posts: 26
Reputation: 485

Post » Sun Sep 04, 2016 1:35 pm

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.

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
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Sun Sep 04, 2016 2:36 pm

B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Sun Sep 04, 2016 3:05 pm

Message: amitkuliyal can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
TwinBlazar wrote: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.

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


okay so that's what i was missing, thanks a lot man for these many refferences also , really appriciate it :D
B
10
Posts: 26
Reputation: 485

Post » Sun Sep 04, 2016 3:06 pm

Message: amitkuliyal can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Gmoney wrote:Use this method, amitkuliyal. :mrgreen:

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


thanks buddy
B
10
Posts: 26
Reputation: 485

Post » Sun Sep 04, 2016 4:17 pm

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. :mrgreen:
B
11
S
6
G
15
Posts: 256
Reputation: 9,207


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests