How do I spawn sprites on a specific value?

  • 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..

  • 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

  • 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..

  • Need to pick the spawning sprite.

    Use the System condition > Is between values, to compare.

  • 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

  • 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

  • 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

  • This worked like a charm for me

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • fav.me/db4iwbh

    like this? it dosent work for me

  • 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

  • my combos increases by two each successful button press on a specific time and will reset back to 0 on an unsuccessful button press like a timing based game i also changed it like you suggested but the sprite spawning is still the sprite 2 not sprite 3

  • i guess is really that hard to do

  • As nickar said, it is not know how you exactly increase/decrease 'combo'.

    Even not with that weird explanation (to me) above. So lets (again) gamble.

    If Combo gets its value with some logic, then the spawning works as expected.

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

    You can drag the green one to alter the overlap condition.

    So, what i miss (besides a clear .capx) ?

  • here's a pic on how i get scores and how the combo meter increases

    fav.me/db4kabr

  • So the question changed now to "Why is 'combo' always zero?" ?

    Press W, and when sprite 4 overlaps sprite 3, you subtract combo from combo ?

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