How do I spawn random sprite?

  • hi to all

    when i kill one enemy, he spawn a coin, how do for spawn random object? for example

    70% coin 20% maibe armor 10 % sometingh special??

    tnk in advance

  • set a local variable to random(1,100) then use logic to split the outcomes, if less than 70 do A, if between 70 and 90 do b, if greater than 90 do C.

  • i not know how to do.. have a capx file for example??

    how to set local variable? when i push "V" give me only global..

  • ok i made a local variable.. what i set??

    if is less 30... what is less?? a local variable?

    cause this enemy come from spawn and is infinite.. never end... and when i kill it i want a sivler coin.. but some time.. a gold coin...

    sorry now i check hot to set a local random(1,100)?? i have try but give me 0

  • no i not solved frist set a local variable...

    then... i do

    every tick set value "local variable" random(1,100)

    then make event i want do...

    and he spawn every object

  • set a local variable to random(1,100) then use logic to split the outcomes, if less than 70 do A, if between 70 and 90 do b, if greater than 90 do C.

    please help he spawn all object i have put 5 object.. when enemy die.. spawn all 5

  • Not every tick. On enemy died : set local variable and then use sub events to decide outcome

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, I have a video I made a long time ago. This will show you how to spawn random enemy, items or whatever you want it to be. This should get you stated so good luck!

    Subscribe to Construct videos now
  • Hello, I have a video I made a long time ago. This will show you how to spawn random enemy, items or whatever you want it to be. This should get you stated so good luck!

    Subscribe to Construct videos now

    hi thank for answer me..

    can you help whit some litte example if i want spawn same monster in the oter level but a different number??

    for example in lv 1 i want 4 monstre in lv 2 i want 9...

    can help please?

  • so what you would have to do is something like and a variable called levels or whatever you want and just add it to the event example I have. First group all the events and call it like Level 1 spawns and add the condition if level is = to 1... spawn these. copy the group and just change it up. if level is = to 3 spawn these. You'll have to make it so when player is on like level 1 set levels to 1, when player is on level 2 set levels to 2 and so on. That way whenever a player is on a certain level you spawn items, enemies or whatever from those groups

  • so what you would have to do is something like and a variable called levels or whatever you want and just add it to the event example I have. First group all the events and call it like Level 1 spawns and add the condition if level is = to 1... spawn these. copy the group and just change it up. if level is = to 3 spawn these. You'll have to make it so when player is on like level 1 set levels to 1, when player is on level 2 set levels to 2 and so on. That way whenever a player is on a certain level you spawn items, enemies or whatever from those groups

    tnk

    iknow this.. but can you make example?? construct 2 does not give you much space with layout management and this I did not understand ...

  • Unfortunately i can't. It takes lots of time to make an example like this and I'm already busy with my two projects and working on things I'm stuck on. You'll just have to learn from my video and hopefully other tips to help you out. Best of luck

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