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.

Dark GDK / Help Spawning Sprite Randomly with Random Animation

Author
Message
elsole
14
Years of Service
User Offline
Joined: 4th Dec 2009
Location:
Posted: 19th Feb 2010 15:28
How can i make my sprite spawn randomly lets say from the right with a random animation frame wherein they will have the same spriteframe playing as they spawn
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 19th Feb 2010 16:52 Edited at: 19th Feb 2010 16:53
dbRND();

you can use it like:


where:
SpriteID = id of the sprite
Max_X = maximum x position for spawning
Max_Y = maximum y position for spawning
ImageID = ID of the sprite image

note the dbRND will return a value from 0 to the specified range, so if you want to get like, from 10 - 20, you should:


also, dont forget to use dbRandomize(dbTimer()); at the begining of your program, so you get different result everytime you run the program

Hope that helps

elsole
14
Years of Service
User Offline
Joined: 4th Dec 2009
Location:
Posted: 20th Feb 2010 06:31
oh thanks...btw if i have created an animated sprite. how can i make them spawn with different frame?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 20th Feb 2010 07:27
same method, but dbSetSpriteFrame instead of position

elsole
14
Years of Service
User Offline
Joined: 4th Dec 2009
Location:
Posted: 21st Feb 2010 03:13
ok thanks got i now...

Login to post a reply

Server time is: 2024-10-02 01:41:48
Your offset time is: 2024-10-02 01:41:48