How do I spawn multiple copies of a Sprite?

0 favourites
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • If I have Sprite1 get destroyed and I want 1-5 copies of Sprite2 to spawn after, how would I set that up?

  • EDIT: Unless you mean you have 1-5 versions or types of Sprite2, rather than all being the same copy of Sprite2. I posted another comment in the thread linked to below, covering that concept a bit. I'm just confused what exactly you want to happen when Sprite1 becomes destroyed.

    I answered a very similar question question here, https://www.construct.net/en/forum/construct-3/how-do-i-8/spawn-object-either-location-170881#forumPost1072832 mbuckenmeyer90

    Also quoted the entire thing below. It would be the exact same concept. You can choose where to spawn/create the 5 copies of Sprie2 wherever you set the X, Y coordinates to. Just take out the Block setting a variable to Random(1,5).

    If you just want to spawn 5 copies of Sprite 2 in the same spot as Sprite 1. Then have Sprite1 spawn Sprite2 five separate times, then become destroyed. I'm not exactly sure what you are trying to accomplish. But it would be very similar to your other question answered yesterday.

    Except, rather than choosing a random amount from 1-5 through a variable, to pick how many copies of Sprite2 to create. Just create 5 copies at your desired locations on the X & Y coordinates you would like them to spawn. Unless you want them to all spawn in the same location as Sprite1, then that is even easier. Just have Sprite1 spawn Sprite 2 directly, then destroy Action under that.

    I could create another sample screenshot. If you are looking for something different than this.

    Quoted Post

    "That would look something like the image below.

    When "Locations" equals 1 or 2, I have the System Creating Sprite2 at random locations within the X & Y coordinates.

    If the same variable equals 2 or 3. I have the System create Sprite2 at specifically chosen locations on the X & Y.

    Finally if the Locations variable equals 5. I have system create Sprite 2, at somewhat random locations on X & Y, using "choose"

    There are many ways you could accomplish this. This just shows one way, using randomly chosen coordinates, specifically chosen, or choosing randomly from a few choices for each the X and the Y location.

    "

  • Thanks bunchos for trying to help me, you are God among men! And I am sorry for how confusing this has been, my brain is getting scrambled. I did post a comment on the other forum first, FYI. Also, I should mention that the more I work on my game the more my game has been evolving/changing and that's why I have been asking a bunch of different questions.

    I think I have an analogy to simplify my current task. We can say Sprite1 is an enemy and Sprite2 is a blood splatter. I'm currently trying to figure out a the simplest way I can have Sprite1/enemy get destroyed and then create about 1-5 copies of Sprite2, randomly across the screen (like it splashed onto the screen)

    So, IE. I would be letting the game decide whether it's just 1 copy of Sprite2 spawned in the top left of the screen OR maybe there's one in the middle bottom and one in the top right.

    (I was also considering adding different versions of blood splatters, But I wasn't sure if I should give Sprite2 an animation with No Loop or if I should make more sprites IE. Sprite3, Sprite4, Sprite5.)

  • I should add I only have the free version of Construct 3. So I am unable to make families.

    There's probably also some other limitations as well.

  • Here is an example of what I have got so far

  • Sure thing. Happy to help, and no worries for confusion. I've done the same with many of my posts asking for help XD

    So blood splattered on the foreground, like it's hitting the screen? Or splattering on the background behind another object, or on a floor(if the game has a top down view)?

    All these things make a lot of difference. It's better to ask how to create an effect you are going for sometimes. Rather than how to do a particular thing. Blood splatter makes sense. And could definitely do that with multiple frames, and calling 1-5 of the sprites, with a random frame. If it's still images, if difference sizes/shapes etc.

    If it's coming towards you(onto the screen). Could have it hit, and slide down a bit/while fading away.

    You are definitely limited with the free version, and the block limit alone means your have to be very conservative with your use of actions & events.

    I'm off night/tomorrow. But, I can try to check back sometime this week. If someone else doesn't jump in sooner.

  • Here is an example of what I have got so far

    It would be on created of blood splatter. Which be called in an event just before the thing is destroyed. Basically when the black block is destroyed, you would create random amount of splatters. With random frames selected. If that's the route you want to go.

    It would be a bit complex for me to get into right now. Heading to bed real soon. But, I'll check back.

    Edit: I definitely recommend going through a bunch of video tutorials, and referencing documentation. I read through the entire documentation, and it still took me a while to figure things out to where I'm at today with Construct. I still reference Documentation often. I leave it open in a tab.

  • mbuckenmeyer90 - Here is the easiest method to achieve this, I could come up with in about 5 minutes. Just click the Black Box, press F5, click it again, repeat. You will see it chose random frames from the Sprite Object, and spawn randomly within the confines of the Layout's Viewport.

    If you want one splatter to show up more than others, or in certain locations more than others. It would become more complicated, and weight could be applied to each one chosen. This is just a very simple/basic approach :)

    I hope this helps :)

    You can download the example here: https://drive.google.com/file/d/1WUQv8gzLDUlGC2R1edqg-BW6TYeLMuRZ/view?usp=sharing

    Screenshot of Event Sheet below :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Apologies. I spaced that you were looking to alter the amount of blood splatters spawned as well. You can see that below as well.

    EDIT: Forgot to remove the On Start of Layout Event. That is useless in the example, and can be removed.

    Download example here: https://drive.google.com/file/d/1nMCWfslemJxWsFMzGfIMi6xseippACJ6/view?usp=sharing

    Screenshot:

  • So it is kind of working now. I set up Sprite2 (blood splatters) with an animation/ So when I destroy Sprite1, the blood splatters hit the screen. But, if I destroy the next Sprite1 (enemy) before the blood splatters fall below the screen or fade away, then the blood splatter that's already on the screen change too.

    This is because I have the animation selected when I destroy the enemy. Is there a way I can tell it to ignore the blood splatters already on the screen?

  • I'm a bit confused. So the previous splatters are being destroyed along with the sprite?

    It's different working with animated sprites, than frames from a sprite.

    Do you have a .c3p file? I might be able to check it out first thing in the morning. Before getting into my own projects.

    There are always many paths to an intended result. But, it greatly depends on how things are currently setup in the project.

    Edit: maybe set the splatters to fade using the Fade behavior. In the fade properties, tick destroy when the fade ends.

    Then, don't have it selected to destroy with the next destroyed sprite?

    Just have it spawn more splatters, while the pre-existing ones fade out and become destroyed at the end of the fade.

    It is difficult to know, without seeing the current layout. It would be easy to check with a .c3p file though :).

    If you're still stuck after trying to figure it out some more, and experimenting with various things. I can take a peak at some point tomorrow. In the morning, or the end of the day, when I take a break from my own business projects. Whenever I have time, I can take 30 minutes here and there.

  • I would share a .c3p file but I have no idea how to do that :(

  • There are a ton of free file hosting websites. Google Drive is the easiest, if you have a google account. If not, it's simple to create one. Would be handy, for sharing things.

  • I have a google account but only used Google drive once long ago, not sure how it works.

  • drive.google.com/file/d/1VPNCNiDuohwlpNDqsROHPypQflLrnQj9/view

    Is this what you need to view it?

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