All pastes #26553 Raw Edit

Mine

public text v1 · immutable
#26553 ·published 2005-10-25 00:19 UTC
rendered paste body
%%Ant Game
setscreen ("Graphics:max;max,offscreenonly")

%%variables
var infobar_size: int := 20     %%The infobarsize

var map: int := Pic.FileNew ("Pics/map.bmp")        %%Gets the map picture
map := Pic.Scale (map,maxx,maxy-infobar_size)      %%Sizes the map

var nestx, nesty: int      %%Nest chords
var food, pop: int      %%Info for ants
var mx, my, mb: int     %%Mouse variables


%%procedures
proc draw_map           %%Draws the map
    Pic.Draw(map,0,0,picCopy)
    drawbox(0,0,maxx,maxy-infobar_size,black)   %%Border around the map
end draw_map
proc draw_nest              %%Draws the nest
    drawfilloval(nestx,nesty,20,20,gray)
end draw_nest

%%little Intro
loop
    Mouse.Where(mx,my,mb)
    cls
    put "Click on the grass to place your nest, somewhere either in the top or bottom parts."

    nestx:= mx      %%Sets the nest cords to where the mouse is
    nesty:= my
    draw_map
    draw_nest    
    if mb = 1 then      %%if you click then
        if my <= 130 and my > 10 or my <= maxy - (infobar_size+10) and my > 530 then   %%if your in the right parts
            exit        %%your done
        else                %%else it shows you where to put your nest
            cls
            draw_map
            for i: 1 .. 5
                drawbox(10+i,10+i,maxx-(10+i),130-i,brightred)
                drawbox(10+i,530+i,maxx-(10+i),maxy-((infobar_size+10)+i),brightred)
            end for
            put "Please select a place either on the top or bottom part."
            View.Update
            Input.Pause
        end if
    end if
    View.Update
end loop

%%main program
loop 
    Mouse.Where(mx,my,mb) 
    cls
    draw_map
    draw_nest
    put mx, "   ", my
    View.Update
end loop