
-----------------------------------
cazo375
Tue Jan 13, 2009 6:56 pm

racing games laps reseting and such
-----------------------------------
i am making a racing game for my isu and i have a few problems
such as:
- laps don't decrease
- cars don't rest after race
 help is much appreciated 
here is code:

View.Set ("offscreenonly")
var chars : array char of boolean
var chars2 : array char of boolean
var pic := Pic.FileNew ("G:/racers/car1.jpg")
var pic2 := Pic.FileNew ("G:/racers/race track.jpg")
var pic3 := Pic.FileNew ("G:/racers/car2.jpg")
var font : int
var player : string (1)
var car := pic
var car2 := pic3
var counter := 0
var counter2 := 0
var x, y : real := 5
var x2, y2 : real := 5
var picRotated : array 0 .. 35 of int
var picRotated2 : array 0 .. 35 of int
var lap, lap2 : int
for rep : 0 .. 35
    picRotated (rep) := Pic.Rotate (pic, rep * 10, Pic.Width (pic) div 2 + 7, Pic.Height (pic) div 2 + 5)
end for
for rep2 : 0 .. 35
    picRotated2 (rep2) := Pic.Rotate (pic3, rep2 * 10, Pic.Width (pic3) div 2 + 7, Pic.Height (pic3) div 2 + 5)
end for
font := Font.New ("Agency FB:18")
loop
    x := 0
    y := 0
    x2 := 0
    y2 := 0
    lap := 3
    lap2 := 3
    getch (player)
    if player = "1" then
        setscreen ("graphics:400,400")
        View.Set ("offscreenonly")
        loop
            drawfill (0, 0, 40, 40)
            drawfillbox (0, 0, 400, 400, 7)
            drawfillbox (50, 50, 350, 350, 2)
            drawfillbox (0, 50, 50, 70, 0)
            drawfillbox (0, 50, 5, 55, 7)
            drawfillbox (0, 60, 5, 65, 7)
            drawfillbox (5, 55, 10, 60, 7)
            drawfillbox (5, 65, 10, 70, 7)
            drawfillbox (10, 50, 15, 55, 7)
            drawfillbox (10, 60, 15, 65, 7)
            drawfillbox (15, 55, 20, 60, 7)
            drawfillbox (15, 65, 20, 70, 7)
            drawfillbox (20, 50, 25, 55, 7)
            drawfillbox (20, 60, 25, 65, 7)
            drawfillbox (25, 55, 30, 60, 7)
            drawfillbox (25, 65, 30, 70, 7)
            drawfillbox (30, 50, 35, 55, 7)
            drawfillbox (30, 60, 35, 65, 7)
            drawfillbox (35, 55, 40, 60, 7)
            drawfillbox (35, 65, 40, 70, 7)
            drawfillbox (40, 50, 45, 55, 7)
            drawfillbox (40, 60, 45, 65, 7)
            drawfillbox (45, 55, 50, 65, 7)
            drawfillbox (45, 65, 50, 70, 7)
            drawfillbox (45, 60, 50, 65, 0)
            drawfillmapleleaf (125, 125, 275, 275, 40)
            Font.Draw ("MINI RACERS", 155, 185, font, 0)
            Font.Draw ("laps to go", 155, 75, font, 0)
            put lap
            Input.KeyDown (chars)
            if chars (KEY_RIGHT_ARROW) then
                counter -= 1
                car := picRotated (counter mod 36)
            end if
            if chars (KEY_LEFT_ARROW) then
                counter += 1
                car := picRotated (counter mod 36)
            end if
            if chars (KEY_UP_ARROW) then
                x += cosd ((counter mod 36) * 10 + 90) * 5
                y += sind ((counter mod 36) * 10 + 90) * 5
            end if
            if chars (KEY_DOWN_ARROW) then
                x -= cosd ((counter mod 36) * 10 + 90) * 5
                y -= sind ((counter mod 36) * 10 + 90) * 5
            end if
            Pic.Draw (car, round (x), round (y), picMerge)
            View.Update
            cls
            delay (25)
            if x = 365 then
                x := x - 3
            end if
            if y = 360 then
                y := y - 3
            end if
            if x 