How do I - Random sprite size.

Get help using Construct 2

Post » Wed May 07, 2014 9:20 am

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!
B
4
Posts: 5
Reputation: 210

Post » Wed May 07, 2014 10:40 am

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
B
245
S
39
G
15
Posts: 1,946
Reputation: 40,266

Post » Wed May 07, 2014 1:09 pm

Thanks for response. I discovered the 'On Created' event, so went with that, followed by > Set Scale to Random(1)+0.5.
B
4
Posts: 5
Reputation: 210

Post » Wed May 07, 2014 1:51 pm

that is good news that's the way to learn. I am happy for you
B
245
S
39
G
15
Posts: 1,946
Reputation: 40,266


Return to How do I....?

Who is online

Users browsing this forum: NadeemAbbass, plinkie and 9 guests