
-----------------------------------
guttface
Tue Mar 02, 2004 9:22 pm

whak-a-mole
-----------------------------------
hey. heres the code to a whak-a-mole im workin on. let me know what you think.
setscreen ("graphics:340;360,position:300;200,nocursor,title:Whak-A-Mole")

var name : string
var sound1 : string
var molenum : int
var molenum2 : int
var difficulty : string (1)
var delay1 : int
var x : int := 60
var y : int := 60
var x1 : int := 60
var y1 : int := 60
var x2 : int := 60
var y2 : int := 60
var timeremain : int := 30
var timeposition : int := maxcol - 3
var gameover : int := 0
var countdownnum : int := 6
var btnnum : int
var btnupdn : int
var moux : int
var mouy : int
var moux1 : int
var mouy1 : int
var score : int := 0
var duration : int
var duration2 : int
var streamNumber : int
var filename : string
var hiscore : array 1 .. 10 of int
var hiscorer : array 1 .. 10 of string
var scorerank : int := 11
var scorerankword : string
var newhigh : string := ""
var count : int := 11
var endprog : string (1)
var fontId : int := Font.New ("verdana:34:bold")
var a : int := 0000
var c : int := 0000
var x4 : int := 10
var y4 : int := 210
var text : string := "Matt"
var buffer : string := ""
var x3 : array 1 .. length (text) of int
var y3 : array 1 .. length (text) of int

colourback (7)
cls

Font.Draw ("WHAK-A-MOLE", 10, 315, fontId, 2)
delay (500)
Font.Draw ("BY:", 10, 265, fontId, 3)
delay (250)
fontId := Font.New ("verdana:45:bold")

for i : 1 .. length (text)
    x3 (i) := x4 + Font.Width (buffer, fontId)
    y3 (i) := y4
    buffer += text (i)
end for

for decreasing i : length (text) .. 1
    for k : 1 .. x3 (i)
        Font.Draw (text (i), k, y3 (i), fontId, 14)
        delay (1)
        drawline (k - 1, y3 (i) - 5, k - 1, y3 (i) + 50, 7)
        Font.Draw (text (i), k - 2, y3 (i), fontId, 7)
    end for
    Font.Draw (text (i), x3 (i), y3 (i), fontId, 14)
    delay (50)
end for

a := 0000
c := 0000
x4 := 10
y4 := 160
text := "Guttman"
buffer := ""
var x5 : array 1 .. length (text) of int
var y5 : array 1 .. length (text) of int


for i : 1 .. length (text)
    x5 (i) := x4 + Font.Width (buffer, fontId)
    y5 (i) := y4
    buffer += text (i)
end for

for decreasing i : length (text) .. 1
    for k : 1 .. x5 (i)
        Font.Draw (text (i), k, y5 (i), fontId, 43)
        delay (1)
        drawline (k - 1, y5 (i) - 5, k - 1, y5 (i) + 50, 7)
        Font.Draw (text (i), k - 2, y5 (i), fontId, 7)
    end for
    Font.Draw (text (i), x5 (i), y5 (i), fontId, 43)
    delay (50)
end for

delay (100)

for count1 : 1 .. 2
    drawfilloval (75, 10, 40, 10, 7)
    drawfillbox (65, 15, 125, 55, 7)


    drawfilloval (75, 46, 40, 40, 4)
    drawfilloval (55, 66, 5, 5, 2)
    drawfilloval (95, 66, 5, 5, 2)
    drawarc (75, 26, 20, 10, 180, 0, 2)

    drawfillbox (110, 80, 150, 100, 0)
    drawfillbox (125, 30, 135, 80, 0)

    delay (500)

    drawfilloval (75, 46, 40, 40, 7)
    drawfillbox (110, 30, 150, 100, 7)

    drawfilloval (75, 10, 40, 4, 4)
    drawfilloval (55, 12, 1, 1, 2)
    drawfilloval (95, 12, 1, 1, 2)
    drawarc (75, 8, 20, 1, 180, 0, 2)

    drawfillbox (65, 15, 85, 55, 0)
    drawfillbox (85, 30, 135, 40, 0)

    delay (500)
end for

drawfilloval (75, 10, 40, 10, 7)
drawfillbox (65, 15, 125, 55, 7)


drawfilloval (75, 46, 40, 40, 4)
drawfilloval (55, 66, 5, 5, 2)
drawfilloval (95, 66, 5, 5, 2)
drawarc (75, 26, 20, 10, 180, 0, 2)

drawfillbox (110, 80, 150, 100, 0)
drawfillbox (125, 30, 135, 80, 0)

delay (500)

colourback (0)
cls
setscreen ("cursor")

loop
    cls
    put "Enter your name:   " ..
    get name : *
    exit when length (name) > 2 and length (name) < 19

    if length (name) < 3 then
        cls
        setscreen ("nocursor,noecho")
        put "THAT NAME IS TOO SHORT!"
        delay (2000)
        setscreen ("cursor,echo")
    elsif length (name) > 18 then
        cls
        setscreen ("nocursor,noecho")
        put "THAT NAME IS TOO LONG!"
        delay (2000)
        setscreen ("cursor,echo")
    end if
end loop

loop
    cls
    put "Enter difficulty 1-3:   " ..
    getch (difficulty)
    exit when difficulty = "1" or difficulty = "2" or difficulty = "3"
end loop

loop
    cls
    put "Sound on or off?   " ..
    get sound1
    exit when sound1 = "on" or sound1 = "off"
end loop

cls

setscreen ("nocursor,noecho")

if difficulty = "1" then
    delay1 := 250
    duration := 120
    duration2 := 60
    filename := Dir.Current + "\\highscore1"
elsif difficulty = "2" then
    delay1 := 125
    duration := 237
    duration2 := 118
    filename := Dir.Current + "\\highscore2"
elsif difficulty = "3" then
    delay1 := 63
    duration := 470
    duration2 := 234
    filename := Dir.Current + "\\highscore3"
end if

if sound1 = "on" then
    sound1 := "