How do I randomly spawn b/w 3 sprites ONLY if not spawned?

Get help using Construct 2

Post » Thu Jan 21, 2016 5:22 am

Hi there,
I wasnt sure how to phrase this question,
so I will provide a screencap of my eventsheet along with the capx for reference

Basically I have 3 sprites:
Sprite_01, Sprite_02, Sprite_03

They are all spawned from the same Origin:
SpriteSpawner

Im choosing between 3 numbers randomly by using: choose(1,2,3)
which triggers which is spawned

when spawned, they head over to a WayPointSprite first:
SpriteWayPoint

before they head to their Death at:
SpriteDestroy

What I would like to do is have them spawn randomly as they are doing at the moment,
but if Sprite_01 is already spawn,
I would like it to ONLY choose between Sprite_02 or Sprite_03 for its next generation
and ONLY spawn another Sprite_01 once it has reached its death

MANY THANKS in advance for any help i can get with this,
I have been at this for days, with different boolean techniques without success

eventsheet:
https://drive.google.com/file/d/0B6wEKR8eqR4NZTZnYkFsVDNkVFk/view?usp=sharing

capx:
http://we.tl/nIAQ0R6GD0
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Post » Thu Jan 21, 2016 6:19 am

You could use a variable off/on for each one (sprite1=0, sprite1=1, etc) and condition/sub-condition down:
sprite1=0,sprite2=0, sprite3=0, choose(1,2,3)
Else
---Sprite1=1,sprite2=0,sprite3=0, choose(2,3)
etc

or condition using is on-scene or X on layout instead of variable.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
56
S
15
G
8
Posts: 610
Reputation: 8,821

Post » Thu Jan 21, 2016 4:01 pm

@chrisinfinger
Many thanks for your 2 suggestions

I'll give it a whirl

Is there a specific expression you had in mind for the 2nd suggestion? (is on-scene) (x on layout)
that sounds reasonably straightforward
but if you could give me a nudge in the right direction, it would be greatly appreciated

tks again!
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Post » Thu Jan 21, 2016 4:48 pm

Another option is this plugin: plugin-smart-random_t163624
ImageImageImage
B
71
S
20
G
192
Posts: 3,535
Reputation: 109,344

Post » Thu Jan 21, 2016 6:17 pm

thanks @blackhornet, I'll give that a look! :)
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Post » Thu Jan 21, 2016 9:23 pm

blackhornet wrote:Another option is this plugin: plugin-smart-random_t163624

@blackhornet

thanks again for your help.
ive been trying to use your plugin without success
could you take a look at my screencapture to see what imdoing incorrectly?
i have the values set at 1-3 and 3 as my threshold, but it still seems to repeat
what can i be doing wrong?
many thanks in advance

Carlos

Image
Image

capx
https://drive.google.com/file/d/0B6wEKR8eqR4NX3BMR281bEdCU2s/view?usp=sharing
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Post » Thu Jan 21, 2016 10:28 pm

Now that I've reread your requirements, my plugin won't help. chrisinfinger has the correct solution as you must take into account what items are alive at the time of the next spawn. Having said that, your pathfinding is wrong. 1) I'd put the behaviour on the family, not the individual sprites, 2) you call "Find path" and that's it. You need to add "On path found" and then call "Move along path". Remove the "is not moving along path, as that will be true as it's trying to calculate the path.
ImageImageImage
B
71
S
20
G
192
Posts: 3,535
Reputation: 109,344

Post » Thu Jan 21, 2016 10:34 pm

chrisinfinger wrote:You could use a variable off/on for each one (sprite1=0, sprite1=1, etc) and condition/sub-condition down:
sprite1=0,sprite2=0, sprite3=0, choose(1,2,3)
Else
---Sprite1=1,sprite2=0,sprite3=0, choose(2,3)

@chrisinfinger

Thanks again for the suggestions, I tried following your logic both ways without success
Could you kindly take a look at my event sheet to see what i may be doing incorrectly?
many thanks in advance!

Image

https://drive.google.com/file/d/0B6wEKR8eqR4NUGh3RW4yNEplUjQ/view?usp=sharing
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Post » Thu Jan 21, 2016 10:37 pm

@blackhornet

Thanks for the feedback @blackhornet
I was going nuts trying to figure that one out

I tried the other method mentioned but without much luck
anything I could be doing wrong?

Image
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Post » Thu Jan 21, 2016 10:55 pm

[quote="cjuliao"]@blackhornet

Thanks for the feedback @blackhornet
I was going nuts trying to figure that one out

I tried the other method mentioned but without much luck
anything I could be doing wrong?

capx:
https://drive.google.com/file/d/0B6wEKR8eqR4NMWgyQWF2bkJPUjQ/view?usp=sharing

Image
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
13
S
2
Posts: 56
Reputation: 1,558

Next

Return to How do I....?

Who is online

Users browsing this forum: imhotep22, tetuan and 11 guests