How do I - Random sprite size.

0 favourites
  • 4 posts
From the Asset Store
220 Food Sprites in 16x16 pixel size. Perfect for items for a retro style game.
  • Hi all,

    First post, be gentle with me.

    I'm creating a side to side shooter (retype style) game and I can't figure out how put a random size on the enemy sprites that I'm spawning. Got some lovely sine movement on them as they go across the screen, but could do with a little bit of difference in size to give a bit more variation.

    I'd rather not create a duplicate of the sprite as it's more to load. I thought I could set up an instance variable as a random size number, and then apply that into the size properties somehow, but it doesn't seem to like that. And I can't find an obvious way to do it in an event without effecting all enemy sprites on screen.

    It's probably really obvious as I can't find any other posts asking the same question!

    Any help appreciated.

    Thanks!

  • You could try setting size like this in events

    mysprite = setsize to int(random(64,64)) and see then work it out from this how big or small you want the size

  • Thanks for response. I discovered the 'On Created' event, so went with that, followed by > Set Scale to Random(1)+0.5.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that is good news that's the way to learn. I am happy for you

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