Random Objects appearing at random.

BlitzPlus Forums/BlitzPlus Beginners Area/Random Objects appearing at random.

En929(Posted 2012) [#1]
Last time I got help with making one object appear at Random. Now, I'm trying to figure out how to make it so that one of these three objects appear at Random (to where even I wouldn't know which ball the computer is going to make appear because the computer randomly selects one of the balls). And I'm trying to make it so that the computer have the appearance of one of the 3 objects keep dropping out of the sky. Thanks.



Graphics 1280, 800, 32 
SetBuffer BackBuffer() 
GameTimer=CreateTimer(20) 




Global RedBall = LoadImage ("RedBall.png")
Global OrangeBall = LoadImage ("OrangeBall.png")
Global GreenBall = LoadImage ("GreenBall.png")



Type Ball1
 
 Field x,y
 Field image 

End Type



Type Ball2
 
 Field x,y
 Field image 

End Type



Type Ball3
 
 Field x,y
 Field image 

End Type


B1.Ball1 = New Ball1
b1\x = 100
b1\y = 0
b1\image = RedBall

B2.Ball2 = New Ball2
b2\x = 150
b2\y = 0
b2\image = OrangeBall

B3.Ball3 = New Ball3
b3\x = 200
b3\y = 0
b3\image = GreenBall



While Not KeyDown(1)

Cls


DrawImage b1\image, b1\x, b1\y

DrawImage b2\image, b2\x, b2\y

DrawImage b3\image, b3\x, b3\y





Flip
Wend 




Last edited 2012

Last edited 2012