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

No comments:

Post a Comment