Thursday, 13 June 2013

Semi Productive

Today was only semi productive, I could not make both levels successfully in the loop but I had managed to incorporate the second level loop with the control loop, I just need to get the procedures and placements correctly, I also learned and developed my 3rd level and will work on this tomorrow.
My Code :View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3, font4 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4
var chars : array char of boolean
var Timme : string
var chars1, chars2 : char
var Timer : int := 35
var timee : int := 0
var StringTimer : string
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := brightred
font1 := Font.New ("Comic Sans:30:bold,underline")
font2 := Font.New ("Comic Sans:10:underline")
font3 := Font.New ("Comic Sans :30:bold")
font4 := Font.New ("Arial :20: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 Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
var Ball2XV : array 1 .. 100 of real
var Ball2YV : array 1 .. 100 of real
Ball2XV (1) := -1
Ball2YV (1) := 1
var CollisionCheck : real
NumBall2 := 1
    var Ballx : array 1 .. 1000 of int
    var Bally : array 1 .. 1000 of int
    randint (Ballx (NumBall2), 0, maxx)
    randint (Bally (NumBall2), 0, maxy)
    var Balldirx : array 1 .. 1000 of int
    var Balldiry : array 1 .. 1000 of int
    Balldirx (1) := -1
    Balldiry (1) := 1
loop
   
     for d : 1 .. NumBall2
            drawfilloval (Ballx (d), Bally (d), BallRadius, BallRadius, 31)
            Ballx (d) := Ballx (d) + Balldirx (d)
            if Ballx (d) - 9 = 9 then
                Balldirx (d) := Balldirx (d) * -1
            elsif Ballx (d) + BallRadius >= maxx - BallRadius
                    then
                Balldirx (d) := -1 * Balldirx (d)
                NumBall2 := NumBall2 + 1
                randint (Ballx (NumBall2), 0, maxx)
                randint (Bally (NumBall2), 0, maxy)
                Balldirx (NumBall2) := -1
                Balldiry (NumBall2) := 1
            end if
            Bally (d) := Bally (d) + Balldiry (d)
            if Bally (d) >= maxy - BallRadius
                    then
                Balldiry (d) := -1 * Balldiry (d)
            elsif Bally (d) <= BallRadius
                    then
                Balldiry (d) := 1
            end if
        end for
        View.Update
        delay (5)
 
 View.Update
 cls
drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
  Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BoxY2 <= maxy
            then
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
        BallPlayerY := BallPlayerY + 1
    elsif chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BoxY1 >= 0
            then
        BallPlayerY := BallPlayerY - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    elsif chars (KEY_RIGHT_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BoxX1 <= maxx
            then
        BoxX1 := BoxX1 + 1
        BoxX2 := BoxX2 + 1
        BallPlayerX := BallPlayerX + 1
    elsif chars (KEY_LEFT_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BoxX2 >= 0
            then
        BallPlayerX := BallPlayerX - 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BallPlayerY + BallPlayerRadius <= maxy and BoxX2 >= 0 and BoxY2 <= maxy
            then
        delay (2)
        BallPlayerX := BallPlayerX - 1
        BallPlayerY := BallPlayerY + 1
        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 BallPlayerY + BallPlayerRadius <= maxy and BallPlayerX + BallPlayerRadius <= maxx and BoxY2 <= maxy and BoxX1 <= maxx
            then
        delay (2)
        BallPlayerX := BallPlayerX + 1
        BallPlayerY := BallPlayerY + 1
        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 BallPlayerX + BallPlayerRadius <= maxx and BallPlayerY - BallPlayerRadius >= 0 and BoxX1 <= maxx and BoxY1 >= 0
            then
        delay (2)
        BallPlayerX := BallPlayerX + 1
        BallPlayerY := BallPlayerY - 1
        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 BallPlayerY - BallPlayerRadius >= 0 and BallPlayerX - BallPlayerRadius >= 0 and BoxY1 >= 0 and BoxX2 >= 0
            then
        delay (2)
        BallPlayerX := BallPlayerX - 1
        BallPlayerY := BallPlayerY - 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    end if
    if
            chars ('g')
            then
        Color := black
    end if
    if chars ('r')
            then
        Color := brightred
    end if
end loop

   

No comments:

Post a Comment