How do I spawn the same object in different places?

0 favourites
  • 8 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi guys, I have one sprite that has a bullet behavior, and 2 another sprites with no behavior, its in these sprites where the bullet sprite must spawn, but the 'choosen' spawner sprite must be random. I dont know how to do that in the C2.

    Could someone give a help?

    In pseudo language, it would be something like this.

    Every random (1, 2) seconds do{
              Choose randomly 'Sprite A' or 'Sprite B';          
              Spawn 'Bullet Sprite' in the sprite choosen;
    }[/code:74sa5fp8] w.dropbox.com/s/dptx0tup1mek1qc/spawn2places.capx
  • "System --> pick random instance" could do that for you. Then on the action spawn the bullet.

  • "System --> pick random instance" could do that for you. Then on the action spawn the bullet.

    It worked, thx for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Now I have another question, I dont know if post here or if should create another topic.

    Can I change the bullet movement angle, depending on the instance where the bullet was spawned?

    This is my example now:

    dropbox.com/s/dptx0tup1mek1qc/spawn2places.capx

  • Sure. You could create an instance variable and then set the angle to what you want depending on which of the instance you picked.

    Use System --> compare two values after you have picked the random spawner instance.

  • Sure. You could create an instance variable and then set the angle to what you want depending on which of the instance you picked.

    Use System --> compare two values after you have picked the random spawner instance.

    thx for the reply, but I didn't get, Should I create an instance variable for the Spawner sprite or to the Bullet Sprite?

  • If you want the spawner to spawn bullets in a curtain angle you should keep that angle on a instance variable on the spawner sprite.

  • If you want the spawner to spawn bullets in a curtain angle you should keep that angle on a instance variable on the spawner sprite.

    Ok, I did that, but I'm still missing something, because it's only changing the angle of motion of the bullets that had already created, I want the inverse situation :p

    take a look:

    www . dropbox. com/s/dptx0tup1mek1qc/spawn2places.capx

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