How do I Randomize Sprite Spawns

0 favourites
  • 7 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • OK, so right now I'm working a zombie themed top-down shooter. When enemies die they spray blood and then they spawn a blood sprite on the ground. What I want to do is to randomize the sprites because I have two sprites for blood. This is my first project so detailed instructions would be nice if this is at all possible.

  • Hi, you can do this:

    Have just 1 object for blood, but the 2 differentes sprites as frames in the animation... set the animation speed to 0.

    then create that object (blood) and "set animtion frame" to choose(0,1) that will choose either frame 0 (blood 1) or frame 1 (blood 2) and that's all.

    one more thing, it's easier when uploading files to save as capx.

    good luck

  • ok so it just plays through the frames, how do i get it to freeze?

  • the first line, set animation speed to 0

  • You choose the frame you want displayed via actions after you have set animation speed to 0.

    If you want it to be random you will need to put an instance variable in the object called something like splatter then On created event have it do a choose(0,1) action and set the zombies splatter variable at creation to 0 or 1. Now in the zombie die event add two sub-events with conditions of splatter = 0 then action set frame 0 and condition event splatter = 1 set frame 1 actions.

  • You choose the frame you want displayed via actions after you have set animation speed to 0.

    If you want it to be random you will need to put an instance variable in the object called something like splatter then On created event have it do a choose(0,1) action and set the zombies splatter variable at creation to 0 or 1. Now in the zombie die event add two sub-events with conditions of splatter = 0 then action set frame 0 and condition event splatter = 1 set frame 1 actions.

    That's a lot of events instead of

    Splatter on created

    • splatter set frame to : choose(0,1)
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:35dojwle]That's a lot of events instead of

    Splatter on created

    • splatter set frame to : choose(0,1)

    I knew there had to be a more efficient way to use choose.

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