How do I repeat after destroy an object??? (CAPX Included)

Get help using Construct 2

Post » Fri Sep 23, 2016 7:36 pm

Hey guys! I have a problem, could you help me please? :roll:

I have 5 objects and i want to repeat each time but only the object(s) which is not destroyed.
To understand, when the game starts appear 1 object each time and after 2 sec disappear and repeat again with the new or the same object (random).

Now, if i click above i can destroy it. If not the object will disappear after 2 sec and random again. For example we have 5 objects means: Red box, Blue box, Green box, Yellow box, Black box.

The game random the boxes again and again automatically. So, if i click on red box i will destroy it, Ok!
Now i want the game to random the 4 boxes not the 5 again.

Anyone???

I hope it's not too complex, so here is the capx file:
https://www.dropbox.com/s/ied5u9vui9h4h8h/BoxesDemo.capx

Do whatever you want with the code.. Hope you find a solution.

Thank you! ; -)
B
54
S
34
G
15
Posts: 231
Reputation: 13,089

Post » Fri Sep 23, 2016 9:14 pm

Image
B
12
S
3
G
5
Posts: 9
Reputation: 3,198

Post » Fri Sep 23, 2016 10:03 pm

hmmm.. first of all thank you for your help my friend! ;)
I test it, but i think is not working very well.. There is a lot space between boxes.
When you destroy some, you need to wait a lot. Think to have 100 boxes.. hehe! :P
Thanks again!!!
B
54
S
34
G
15
Posts: 231
Reputation: 13,089

Post » Fri Sep 23, 2016 10:57 pm

This long wait happens because the choose keep choosing the boxes that already have been destroyed. I'll think in some solution for this. keep trying.
Image
B
12
S
3
G
5
Posts: 9
Reputation: 3,198

Post » Sat Sep 24, 2016 12:56 am

You can run a 'pickedcount=1' check with an else, like this :
https://dl.dropboxusercontent.com/u/495 ... dited.capx
B
47
S
17
G
82
Posts: 2,230
Reputation: 48,607

Post » Sat Sep 24, 2016 3:13 am

@odiusfly
i make this system with little help from @korbaach , @plinkie "pick random instance" :P

when you say " Think to have 100 boxes.. hehe! :P"

if you are use your method i think you need 100-200 event and every system w8 1 sec destroy etc etc this make all system delay i think..

here a example : https://drive.google.com/file/d/0B8mc-_ ... sp=sharing

i dont know where to use this all .. but if you want to use deference color or what ever say it to fix it ;)
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

Post » Sat Sep 24, 2016 5:21 am

Thank you all guys, I appreciate it! ; -)))

@luizcarlosr
Thank you for your time!

@plinkie
Thank you, great fix!

@CBelle
Thanks a lot!
This method i want to use to a complex project and you help me a lot!
Last edited by odiusfly on Sat Sep 24, 2016 7:57 am, edited 1 time in total.
B
54
S
34
G
15
Posts: 231
Reputation: 13,089

Post » Sat Sep 24, 2016 7:56 am

@plinkie

Hey, i see your fix carefully, and you use position method, so can i use destroy with some way?
I try without luck. Thanks again!
B
54
S
34
G
15
Posts: 231
Reputation: 13,089

Post » Sat Sep 24, 2016 3:23 pm

The boxes are destroyed when you click them. You used a change position method but you could really do anything. You could have all of the boxes invisible and then set visible, up to you.
B
47
S
17
G
82
Posts: 2,230
Reputation: 48,607

Post » Sat Sep 24, 2016 4:00 pm

@odiusfly

I do not see any reason to use several objects. That makes it only more complicated. The strength of C2 lays in using instances where possible.

Randomness like this is much easier when using an array.
There are plugins to help you with that, like this awesome one : plugin-smart-random_t163624

But this problem is a bit to basic to bring in a 3th party plugin.

So lets do it in 11 events with 1 simple array and 1 sprite.

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

I did't change the timings. I took every 2 seconds as strict as you said.

Suppose you dont want to wait after a click.

https://www.dropbox.com/s/r2em989h8miqy ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: Christmas, Lancifer and 24 guests