Today was a fruitful day, I have finished my array ball composition successfully, I now need to work on the collision and think about using a timer. My further goals are to create new levels with Ball moving with different vectors.
Code: View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3 : int
var chars : array char of boolean
var chars1, chars2 : char
BoxX1 := maxx div 2
BoxX2 := maxx div 2.4
BoxY1 := maxy div 10
BoxY2 := maxy div 4.7
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := 30
font1 := Font.New ("Comic Sans:30:bold,underline")
font2 := Font.New ("Comic Sans:10:underline")
font3 := Font.New ("Comic Sans :30:bold")
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var NumBall : int := 1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
procedure GameMenu %Creates Game Menu
loop
drawfillbox (0, 0, maxx, maxy, 103)
Font.Draw ("Welcome To The World's Hardest Game", maxx div 7, maxy div 2, font1, red)
Font.Draw ("To Start, Press 'S' ", maxx div 2, maxy div 4, font2, red)
Font.Draw ("To View Controls, Press 'C' ", maxx div 2, maxy div 6, font2, red)
get chars1
if chars1 = ('S')
then
exit
elsif chars1 = ('C')
then
drawfillbox (0, 0, maxx, maxy, 103)
Font.Draw ("Controls", maxx div 7, maxy div 1.13, font3, red)
Font.Draw ("The controls are rather simple: Use the cursor keys to move.", 100, 401, font2, red)
Font.Draw ("Avoid any bouncing balls as you will lose one of your 3 lives.", 100, 351, font2, red)
Font.Draw ("Reach The 'CheckPoint' and you will progress into harder levels.", 100, 301, font2, red)
Font.Draw ("If you progress far enough, you will gain the ability to shoot, at which point the 'SPACEBAR' will be the shoot button.", 100, 251, font2, red)
Font.Draw ("Good Luck and Have Fun!", 100, 201, font2, red)
% Font.Draw ("To Return, press 'R'", maxx div 1.5, maxy div 7, font2, red)
Font.Draw ("To Start Press, 'S' ", maxx div 2.3, maxy div 13, font2, red)
View.Update
end if
get chars2
if chars2 = ('S')
then
exit
elsif chars2 = ('R')
then
% end if
end if
end loop
end GameMenu
GameMenu
loop
drawfillbox (0, 0, maxx, maxy, 149)
drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 31)
for d : 1 .. NumBall
drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, 31)
BallX (d) := BallX (d) + BallXV (d)
if BallX (d) = maxx - BallRadius
then
NumBall := NumBall + 1
BallXV (NumBall) := -1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
BallXV (d) := -1
elsif
BallX (d) = BallRadius
then
BallXV (d) := 1
end if
end for
View.Update
cls
%CONTROLS
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) and BoxY2 <= maxy
then
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
then
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
then
BoxX1 := BoxX1 + 1
BoxX2 := BoxX2 + 1
elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
end loop
Monday, 3 June 2013
Thursday, 30 May 2013
Today I have started completed the Game Menu, I still need to fix the color scheme and understand how to make the balls act in an array. I will work on this further at home so the true game will come into effect.
I also will work on the transition between levels and understand how the game will gain power-ups etc..
View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallX, BallY, BallRadius, move, BallRand, Color, font1, font2, font3 : int
var chars : array char of boolean
var chars1, chars2 : char
BoxX1 := maxx div 2
BoxX2 := maxx div 2.4
BoxY1 := maxy div 10
BoxY2 := maxy div 4.7
BallX := maxx - 12
BallY := maxy div 1.9
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := 30
font1 := Font.New ("Comic Sans:30:bold")
font2 := Font.New ("Comic Sans:10:bold")
font3 := Font.New ("Comic Sans :30:bold")
procedure GameMenu
loop
drawfillbox (0, 0, maxx, maxy, 103)
Font.Draw ("Welcome to Umang's Hardest Game", maxx div 7, maxy div 2, font1, red)
Font.Draw ("To Start Press, 'S' ", maxx div 2, maxy div 4, font2, red)
Font.Draw ("To View Controls, Press 'C' ", maxx div 2, maxy div 6, font2, red)
get chars1
if chars1 = ('S')
then
exit
elsif chars1 = ('C')
then
drawfillbox (0, 0, maxx, maxy, 103)
Font.Draw ("Controls", maxx div 2, maxy div 1.4, font3, red)
Font.Draw ("To Return, press 'R'", maxx div 1.5, maxy div 10, font2, red)
Font.Draw ("To Start Press, 'S' ", maxx div 2, maxy div 4, font2, red)
get chars2
if chars2 = ('S')
then
exit
elsif chars2 = ('R')
then
end if
end if
end loop
end GameMenu
GameMenu
loop
drawfillbox (0, 0, maxx, maxy, 149)
drawfilloval (BallX, BallY, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 50, BallRadius, BallRadius, 30)
drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
drawfilloval (BallX, BallY + 150, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 100, BallRadius, BallRadius, 30)
% drawfilloval (BallX, BallY + 200, BallRadius, BallRadius, 30)
% drawfillbox (450, 500, 480, 470, 30)
drawfillbox (maxx div 2.1, maxy div 1.4, maxx div 1.9, maxy div 1.01, 66)
BallX := BallX - move
%Font.Draw ("CheckPoint", maxx div 2.5, maxy div 1.08, font1, black)
View.Update
if BallX = BallRadius
then
move := -move
elsif
BallX = maxx - BallRadius
then
move := +1
end if
%CONTROLS
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) and BoxY2 <= maxy
then
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
then
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
then
BoxX1 := BoxX1 + 1
BoxX2 := BoxX2 + 1
elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if BallX + BallRadius = BoxX2 and BallY + BallRadius = BoxY2 or BallY + BallRadius = BoxY1 or BallY + BallRadius = (BoxY1 + BoxY2) div 2
then
move := -1
end if
if BallX = (BoxX1 + BoxX2) div 2 and BallY = BoxY1 or BallY = BoxY2
then
Color := Rand.Int (30, 256)
end if
end loop
var BoxX1, BoxX2, BoxY1, BoxY2, BallX, BallY, BallRadius, move, BallRand, Color, font1, font2, font3 : int
var chars : array char of boolean
var chars1, chars2 : char
BoxX1 := maxx div 2
BoxX2 := maxx div 2.4
BoxY1 := maxy div 10
BoxY2 := maxy div 4.7
BallX := maxx - 12
BallY := maxy div 1.9
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := 30
font1 := Font.New ("Comic Sans:30:bold")
font2 := Font.New ("Comic Sans:10:bold")
font3 := Font.New ("Comic Sans :30:bold")
procedure GameMenu
loop
drawfillbox (0, 0, maxx, maxy, 103)
Font.Draw ("Welcome to Umang's Hardest Game", maxx div 7, maxy div 2, font1, red)
Font.Draw ("To Start Press, 'S' ", maxx div 2, maxy div 4, font2, red)
Font.Draw ("To View Controls, Press 'C' ", maxx div 2, maxy div 6, font2, red)
get chars1
if chars1 = ('S')
then
exit
elsif chars1 = ('C')
then
drawfillbox (0, 0, maxx, maxy, 103)
Font.Draw ("Controls", maxx div 2, maxy div 1.4, font3, red)
Font.Draw ("To Return, press 'R'", maxx div 1.5, maxy div 10, font2, red)
Font.Draw ("To Start Press, 'S' ", maxx div 2, maxy div 4, font2, red)
get chars2
if chars2 = ('S')
then
exit
elsif chars2 = ('R')
then
end if
end if
end loop
end GameMenu
GameMenu
loop
drawfillbox (0, 0, maxx, maxy, 149)
drawfilloval (BallX, BallY, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 50, BallRadius, BallRadius, 30)
drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
drawfilloval (BallX, BallY + 150, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 100, BallRadius, BallRadius, 30)
% drawfilloval (BallX, BallY + 200, BallRadius, BallRadius, 30)
% drawfillbox (450, 500, 480, 470, 30)
drawfillbox (maxx div 2.1, maxy div 1.4, maxx div 1.9, maxy div 1.01, 66)
BallX := BallX - move
%Font.Draw ("CheckPoint", maxx div 2.5, maxy div 1.08, font1, black)
View.Update
if BallX = BallRadius
then
move := -move
elsif
BallX = maxx - BallRadius
then
move := +1
end if
%CONTROLS
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) and BoxY2 <= maxy
then
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
then
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
then
BoxX1 := BoxX1 + 1
BoxX2 := BoxX2 + 1
elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if BallX + BallRadius = BoxX2 and BallY + BallRadius = BoxY2 or BallY + BallRadius = BoxY1 or BallY + BallRadius = (BoxY1 + BoxY2) div 2
then
move := -1
end if
if BallX = (BoxX1 + BoxX2) div 2 and BallY = BoxY1 or BallY = BoxY2
then
Color := Rand.Int (30, 256)
end if
end loop
Second Day
Yesterday, I had created the balls moving and the checkpoint base. I hope to create the balls in an array so they will move in random directions creating a greater level of difficulty for the user. I also need to create the game menu, which I think I can achieve today and also create the collisions between the balls and the checkpoint. My Code:
View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallX, BallY, BallRadius, move, BallRand, Color, font1 : int
var chars : array char of boolean
BoxX1 := maxx div 2
BoxX2 := maxx div 2.4
BoxY1 := maxy div 10
BoxY2 := maxy div 4.7
BallX := maxx - 12
BallY := maxy div 1.9
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := 30
font1 := Font.New ("times new roman:30:bold")
loop
drawfillbox (0, 0, maxx, maxy, 149)
drawfilloval (BallX, BallY, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 50, BallRadius, BallRadius, 30)
drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
drawfilloval (BallX, BallY + 150, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 100, BallRadius, BallRadius, 30)
% drawfilloval (BallX, BallY + 200, BallRadius, BallRadius, 30)
% drawfillbox (450, 500, 480, 470, 30)
drawfillbox (maxx div 3, maxy div 1.101, maxx div 1.5, maxy, 66)
BallX := BallX - move
Font.Draw ("CheckPoint", maxx div 2.5, maxy div 1.08, font1, black)
View.Update
if BallX = BallRadius
then
move := -move
elsif
BallX = maxx - BallRadius
then
move := +1
end if
%CONTROLS
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) and BoxY2 <= maxy
then
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
then
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
then
BoxX1 := BoxX1 + 1
BoxX2 := BoxX2 + 1
elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if BallX + BallRadius = BoxX2 and BallY + BallRadius = BoxY2 or BallY + BallRadius = BoxY1 or BallY + BallRadius = (BoxY1 + BoxY2) div 2
then
move := -1
end if
if BallX = (BoxX1 + BoxX2) div 2 and BallY = BoxY1 or BallY = BoxY2
then
Color := Rand.Int (30, 256)
end if
end loop
Yesterday, I had created the balls moving and the checkpoint base. I hope to create the balls in an array so they will move in random directions creating a greater level of difficulty for the user. I also need to create the game menu, which I think I can achieve today and also create the collisions between the balls and the checkpoint. My Code:
View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallX, BallY, BallRadius, move, BallRand, Color, font1 : int
var chars : array char of boolean
BoxX1 := maxx div 2
BoxX2 := maxx div 2.4
BoxY1 := maxy div 10
BoxY2 := maxy div 4.7
BallX := maxx - 12
BallY := maxy div 1.9
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := 30
font1 := Font.New ("times new roman:30:bold")
loop
drawfillbox (0, 0, maxx, maxy, 149)
drawfilloval (BallX, BallY, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 50, BallRadius, BallRadius, 30)
drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
drawfilloval (BallX, BallY + 150, BallRadius, BallRadius, 30)
drawfilloval (BallX, BallY + 100, BallRadius, BallRadius, 30)
% drawfilloval (BallX, BallY + 200, BallRadius, BallRadius, 30)
% drawfillbox (450, 500, 480, 470, 30)
drawfillbox (maxx div 3, maxy div 1.101, maxx div 1.5, maxy, 66)
BallX := BallX - move
Font.Draw ("CheckPoint", maxx div 2.5, maxy div 1.08, font1, black)
View.Update
if BallX = BallRadius
then
move := -move
elsif
BallX = maxx - BallRadius
then
move := +1
end if
%CONTROLS
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) and BoxY2 <= maxy
then
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
then
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
then
BoxX1 := BoxX1 + 1
BoxX2 := BoxX2 + 1
elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
then
delay (2)
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
then
delay (2)
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
end if
if BallX + BallRadius = BoxX2 and BallY + BallRadius = BoxY2 or BallY + BallRadius = BoxY1 or BallY + BallRadius = (BoxY1 + BoxY2) div 2
then
move := -1
end if
if BallX = (BoxX1 + BoxX2) div 2 and BallY = BoxY1 or BallY = BoxY2
then
Color := Rand.Int (30, 256)
end if
end loop
Tuesday, 28 May 2013
Blog First Post
Today in class, I created the general concept of my game. You are supposed to control a square past obstacles to make it to the checkpoint, at which point you will progress to the next level. In terms of code, I worked on the graphics, the controls of the square and the check point line. For next class, I will try to create the obstacles and work on the further checkpoints
.%Summative
%Mr. Van Rooyen
%Umang Saksena
%ICS 201
View.Set ("graphics:1000;500,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2 : int
BoxX1 := maxx div 6
BoxX2 := maxx div 4.5
BoxY1 := maxy div 4
BoxY2 := maxy div 6
var chars : array char of boolean
var GoalBox1, GoalBox2, GoalBoxY1, GoalBoxY2 : int
GoalBox1 := 0
GoalBox2 := maxx
GoalBoxY1 := maxy div 1.11
GoalBoxY2 := maxy
loop
drawfillbox (0, 0, maxx, maxy, 150)
Draw.FillBox (GoalBox1, GoalBoxY1, GoalBox2, GoalBoxY2, 42)
drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 31)
View.Update
cls
Input.KeyDown (chars)
if chars (KEY_UP_ARROW)
then
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
elsif chars (KEY_DOWN_ARROW)
then
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
elsif chars (KEY_RIGHT_ARROW)
then
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
elsif chars (KEY_LEFT_ARROW)
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW)
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY2 := BoxY2 + 1
BoxY1 := BoxY1 + 1
delay (2)
elsif chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW)
then
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 + 1
BoxY2 := BoxY2 + 1
delay (2)
elsif chars (KEY_DOWN_ARROW) and chars (KEY_RIGHT_ARROW)
then
BoxX2 := BoxX2 + 1
BoxX1 := BoxX1 + 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
delay (2)
elsif chars (KEY_DOWN_ARROW) and chars (KEY_LEFT_ARROW)
then
BoxX2 := BoxX2 - 1
BoxX1 := BoxX1 - 1
BoxY1 := BoxY1 - 1
BoxY2 := BoxY2 - 1
delay (2)
end if
end loop
Subscribe to:
Posts (Atom)