Next steps are to incorporate it into the full game code and finish making the last level. My second level code:View.Set ("graphics,offscreenonly")
var NumBall : int
NumBall := 1
var Ballx : array 1 .. 100 of int
var Bally : array 1 .. 100 of int
randint (Ballx (NumBall), 0, maxx)
randint (Bally (NumBall), 0, maxy)
var Balldirx : array 1 .. 100 of int
var Balldiry : array 1 .. 100 of int
Balldirx (1) := -1
Balldiry (1) := 1
loop
cls
for d : 1 .. NumBall
drawfilloval (Ballx (d), Bally (d), 9, 9, green)
Ballx (d) := Ballx (d) + Balldirx (d)
if Ballx (d) - 9 = 9 then
Balldirx (d) := Balldirx (d) * -1
elsif Ballx (d) + 9 >= maxx - 9
then
Balldirx (d) := -1 * Balldirx (d)
NumBall := NumBall + 1
randint (Ballx (NumBall), 0, maxx)
randint (Bally (NumBall), 0, maxy)
Balldirx (NumBall) := -1
Balldiry (NumBall) := 1
end if
Bally (d) := Bally (d) + Balldiry (d)
if Bally (d) >= maxy - 9
then
Balldiry (d) := -1 * Balldiry (d)
elsif Bally (d) <= 9
then
Balldiry (d) := 1
end if
end for
View.Update
delay (5)
end loop
No comments:
Post a Comment