How do I spawn sprites on a specific value?

Get help using Construct 2

Post » Mon Apr 03, 2017 8:09 am

Can anyone help me on how to spawn different sprites using one global variable?

for example
if Global combo is greater than 1 but less than 6 it will spawn a sprite however if combo is greater than 7 but less than 12 a different sprite will spawn and so on whenever i tried it nothing spawns..
Last edited by jakeedge02 on Wed Apr 05, 2017 9:05 am, edited 1 time in total.
B
6
S
1
Posts: 36
Reputation: 424

Post » Mon Apr 03, 2017 9:51 am

You need another object to spawn the sprite on to it, or else you have to use the System>create function. Your example lacks an event: When or why?

Example:
System>every 2 sec>Add 1 to Global combo
System>Global combo greater than 1>System> create sprite on layer 1 on X,Y
B
5
Posts: 15
Reputation: 255

Post » Mon Apr 03, 2017 10:05 am

actually its for scoring

Keyboard button press> add 2 to combo

If combo is greater than 1 > spawn sprite 1

If combo is greater than 6 > spawn sprite 2

note that both combo this events are separate

so if Global combo is greater than 1 but less than 6 it will spawn a sprite on button press however if combo is greater than 7 but less than 12 a different sprite will spawn and so on whenever i tried it nothing spawns..
B
6
S
1
Posts: 36
Reputation: 424

Post » Mon Apr 03, 2017 10:08 am

Need to pick the spawning sprite.
Use the System condition > Is between values, to compare.
B
33
S
18
G
28
Posts: 2,475
Reputation: 20,914

Post » Mon Apr 03, 2017 10:16 am

should i add 2 separate compare conditions on the sprites events?

like

On "W" press> If combo is greater than 1>If combo is less than 6 spawn sprite 1

On "W" press> If combo is greater than 6>If combo is less than 12 spawn sprite 2
B
6
S
1
Posts: 36
Reputation: 424

Post » Mon Apr 03, 2017 10:31 am

It won't work correctly because 6 is allready greater than one.

On "W" press> If combo is less than 6> spawn sprite 1

On "W" press> If combo is equal or greater than 6> spawn sprite 2

But what will spawn the sprite? Use another sprite for this

On "W" press> If combo is less than 6>Sprite 3 spawn sprite 1
B
5
Posts: 15
Reputation: 255

Post » Mon Apr 03, 2017 11:55 am

im using 3 sprites if the combo value is greater 1 but less than 6 sprite 1 will spawn sprite 2
if the combo value is greater 6 but less than 12 sprite 1 will spawn sprite 3

what im trying to get help is how to make a condition where sprite 2 will spawn only if the value of combo is for example greater than 1 but less than 6 for sprite 3 the value of combo should be greater than 6 but less than 12 and so on for different sprites
B
6
S
1
Posts: 36
Reputation: 424

Post » Mon Apr 03, 2017 12:14 pm

This worked like a charm for me

Image
B
5
Posts: 15
Reputation: 255

Post » Mon Apr 03, 2017 12:51 pm

Message: jakeedge02 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
http://fav.me/db4iwbh

like this? it dosent work for me
B
6
S
1
Posts: 36
Reputation: 424

Post » Mon Apr 03, 2017 12:55 pm

How does Combo's value changes on your set? You can see an event with time to do that. maybe this is your thing. Also, your 7 is idle now. Make that equal or greater than 7 and less than 13
B
5
Posts: 15
Reputation: 255

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie and 2 guests