
-----------------------------------
Sean
Mon Jun 09, 2008 6:41 pm

Loop / For Loop Not Exiting
-----------------------------------
Alright, going back to Turing now and trying to creat a game. I have the basics down of Mouse.Where, Drawing Random Boxes using arrays, and that, however when my condition is met, it doesn't exit properly. I tried adding in a boolean to set it to true when the condition is met and that it would trigger an outside if statement from the for loop to stop the entire game loop.

I'm confused as to what I am doing wrong. 


View.Set ("offscreenonly")

var x, y, b : int
var box_x, box_y : array 0 .. 10 of int
var checker : boolean := false

loop
    Mouse.Where (x, y, b)
    View.Update
    cls
    for x_position : lower (box_x) .. upper (box_x)
        randint (box_x (x_position), 0, maxx)
    end for

    for y_position : lower (box_y) .. upper (box_y)
        randint (box_y (y_position), 0, maxy)
    end for
    delay (1000)
    for counter : 0 .. 10
        Draw.FillBox (box_x (counter), box_y (counter), box_x (counter) + 30, box_y (counter) + 30, black)
        if x >= box_x (counter) and x = box_y (counter) and x 