
-----------------------------------
petree08
Thu Nov 02, 2006 12:00 pm

Target Shooter
-----------------------------------
This is a game in witch you have 2 shoot has many targets as you can with the mouse.

I kinda jazzed it up a bit by adding my logo and a tittle screen (that looks kinda old shool)

Have Fun!



const TIME_T := 60
const TARGET_NUM := 10
const C_C := 0
var TimeLeft : int := TIME_T
var IntToString : string
var Font1 : int := Font.New ("Arial:20")
var Font2 : int := Font.New ("System:50")
var Font3 : int := Font.New ("System:140")
var Score : int := 0
var Hitter : boolean
var Pauser : char
var Index2 : nat := 1
var Xm, Ym, Click : int
var Clicker : boolean := false
var X, Y, Dx, Dy : array 1 .. TARGET_NUM of int
var Length : array 1 .. TARGET_NUM of real4
var Hit, Miss : nat1 := 0
var YesNo : string (2)

process Bang
    sound (200, 100)
end Bang

procedure Crosshairs

    drawline (Xm - 30, Ym, Xm - 5, Ym, C_C)
    drawline (Xm + 30, Ym, Xm + 5, Ym, C_C)
    drawline (Xm, Ym - 30, Xm, Ym - 5, C_C)
    drawline (Xm, Ym + 30, Xm, Ym + 5, C_C)

    Draw.ThickLine (Xm - 100, Ym, Xm - 30, Ym, 5, C_C)
    Draw.ThickLine (Xm + 100, Ym, Xm + 30, Ym, 5, C_C)
    Draw.ThickLine (Xm, Ym - 100, Xm, Ym - 30, 5, C_C)
    Draw.ThickLine (Xm, Ym + 100, Xm, Ym + 30, 5, C_C)


    drawoval (Xm, Ym, 100, 100, C_C)
    drawoval (Xm, Ym, 30, 30, C_C)

    drawfilloval (Xm, Ym, 3, 3, 12)


end Crosshairs


procedure Random

    for Index : 1 .. TARGET_NUM
        randint (X (Index), 1, maxx)
        randint (Y (Index), 1, maxy)

        loop
            randint (Dx (Index), -1, 1)
            exit when Dx (Index) not= 0
        end loop
        loop
            randint (Dy (Index), -1, 1)
            exit when Dy (Index) not= 0
        end loop
    end for
end Random
process Timer
    loop
        delay (1000)
        TimeLeft := TimeLeft - 1
        exit when TimeLeft = maxx or X (Index) = maxy or Y (Index) = TARGET_NUM %
                Index2 := Index2 + 1  % bumps the target being checked


            end loop
            if Hitter = false then
                Miss := Miss + 1
                Score := Score - 100
            end if
        elsif Click = 0 then
            Clicker := false
        end if
        Crosshairs

        IntToString := intstr (Hit)

        Font.Draw ("Hit :" + IntToString, 10, 10, Font1, C_C)


        IntToString := intstr (Miss)

        Font.Draw ("Miss :" + IntToString, 100, 10, Font1, C_C)
        IntToString := intstr (Score)

        Font.Draw ("Score :" + IntToString, 250, 10, Font1, C_C)

        IntToString := intstr (TimeLeft)

        Font.Draw ("Time left :" + IntToString, 10, maxy - 20, Font1, C_C)



        % put "Hit: ", Hit
        % put "Missed: ", Miss
        % put "Score ", Score

        exit when TimeLeft 