How do I spawn multiple copies of a Sprite?

0 favourites
From the Asset Store
The Lift
$2 USD
60% off
Easy copy/paste lift function for 2D platformer type games
  • brainwavecreations Everade

    So I appreciate the help and I like the simplicity of the repeating action. Also this event doesn't seem to effect the splotches already created but I don't know why. I was hoping one of you could explain to me why that action (with the arrow next to it) is not changing blood splotches already on the screen.

    Additionally, I thought if I created another sub-event and moved that action down to it and not had it repeating then it would make all the splotches created at a single time to be the same (animation) frame, however that is not the case AND it even changes splotches already on the screen.

    So now I'm really confused, I thought I knew what I had to do but I guess not. :(

  • If you add a single event, that sets the animation frame, this will pick ALL instances of an object. So as you've witnessed, it will change all blood splatters currently in existance, not just newly created ones.

    The "Create object" will automatically pick the created object for us. So if you change the animation frame within the same event like we did, then it will only change this particular splatter.

    For example "Repeat 2 times" of an event means, this whole block will be repeated 2 times from top to bottom. Like this:

    1. Create 1 blood sprite
    2. Change its animation frame randomly
    1. Create 1 blood sprite
    2. Change its animation frame randomly

    As you can see, it created 2 blood sprites, but both set an individual animation frame. If you want all of them to be the same, you could define the random number for the animation frame before starting the repeat event, then use that generated number so all blood sprites will be the same.

    This is what you want:

    1. splatterType = Set to number of splatter animation frames
    1. Create 1 blood sprite
    2. Change its animation frame to "splatterType"
    1. Create 1 blood sprite
    2. Change its animation frame to "splatterType"

    Which will look like this:

    https://easyupload.io/fog103

    Tip:

    Add the behavior "Destroy outside of layout" to the "Splotch" sprite. Otherwise the engine is still wasting resources to calculate splatters outside of your screen.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This seems like some pretty advanced stuff. Thank you for explaining everything so thoroughly. I think I am following along with everything.

    Also, thanks for the tip too, I did know that but had not gotten there yet. I typically used 'when an object falls so far below X=#'. Your condition is probably the better option though.

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