----------------------------------- be natural* Sat Jun 07, 2003 2:50 pm looping randint ----------------------------------- in my program, i tried to shoot the bubbles and each time i shoot a bubble, the colour of it changes. So i put randint in the loop to randomize the colour of the bubble, but what happens is that the colours are changing so fast until i press the shift key and then the colour doesn't change while it's being shoot. how can i make the randomly-chosen colour stay as it is before the shooting? I attached my code below... View.Set("graphics:400;600") var xCoor : array 1 .. 3 of int := init (190, 200, 210) var yCoor : array 1 .. 3 of int := init (5, 75, 5) var iColor: int var chars : array char of boolean Draw.FillPolygon (xCoor, yCoor, 3, brightblue) Draw.Polygon (xCoor, yCoor, 3, black) loop randint (iColor, 1, 5) drawfilloval (200, 90, 15, 15, iColor) Input.KeyDown (chars) if chars (KEY_SHIFT) then for i : 90 .. 400 drawfilloval (200, i, 15, 15, iColor) delay (1) drawfilloval (200, i, 15, 15, white) end for drawfilloval (200,400,15,15,iColor) end if end loop ----------------------------------- Catalyst Sat Jun 07, 2003 3:03 pm ----------------------------------- Since this is a very simple fix... all you need to do is randomize the color after it is shot View.Set("graphics:400;600") var xCoor : array 1 .. 3 of int := init (190, 200, 210) var yCoor : array 1 .. 3 of int := init (5, 75, 5) var iColor: int :=1 var chars : array char of boolean Draw.FillPolygon (xCoor, yCoor, 3, brightblue) Draw.Polygon (xCoor, yCoor, 3, black) loop drawfilloval (200, 90, 15, 15, iColor) Input.KeyDown (chars) if chars (KEY_SHIFT) then for i : 90 .. 400 drawfilloval (200, i, 15, 15, iColor) delay (1) drawfilloval (200, i, 15, 15, white) end for drawfilloval (200,400,15,15,iColor) randint (iColor, 1, 5) end if end loop