Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / change random

Author
Message
kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 4th Sep 2012 16:07
how do i change what random is without ending a pience of text. i have random generate a sprite then if the sprite is in use i want a new random sprite, how would i do this? thanks

kirtnicholls
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 6th Sep 2012 00:17
I'm not entirely sure what you're asking for but I think you want to create a new sprite from a random image? If so just simply store the possible image numbers in an array and then select a random index.

E.g Psuedocode
Dim a[10] as integer
images[1] = LoadImage("someimage.png")
.
. // etc
.
images[10] = LoadImage("anotherimage.png")

rnd = random(1,10)
spr = createSprite( images[rnd] )

Login to post a reply

Server time is: 2024-04-30 22:24:21
Your offset time is: 2024-04-30 22:24:21