
-----------------------------------
we64
Mon Jan 26, 2004 2:26 pm

[source] My Hangman Game version 1.1v... (button updates)
-----------------------------------
I updated all of my buttons, so it shows select and release...


%Hangman Game 1.1 v.
%By Tony Zhang
setscreen ("graphics:1000;650")
var x, y, letter : int := 0
var colo : int
var fx, sx, tx : array 1 .. 11 of int := init (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
var words : array 1 .. 15 of string := init ("computer", "baseball", "program", "video", "cat", "dog", "tiger", "driver", "soccer", "radio", "music", "science", "king", "basketball", "chess")
var random, counter, right : int := 0
var word, choice, let : string := ""

process won
    loop
        Draw.Text ("YaY, You won!", maxx div 2 - 100, maxy div 2, Font.New ("serif:24:bold"), Rand.Int (1, 100))
        delay (500)
        exit when choice = "y" or choice = "n"
    end loop
end won

process lost
    loop
        Draw.Text ("You Lost!", maxx div 2 - 50, maxy div 2 - 50, Font.New ("serif:24:bold"), Rand.Int (155, 200))
        Draw.Text ("The word was:", maxx div 2 - 150, maxy div 2, Font.New ("serif:24:bold"), Rand.Int (155, 200))
        Draw.Text (words (random), maxx div 2 + 60, maxy div 2, Font.New ("serif:24:bold"), Rand.Int (155, 200))
        delay (500)
        exit when choice = "y" or choice = "n"
    end loop
end lost

proc playagain
    loop
        if Mouse.ButtonMoved ("down") then
            var buttonnumber, buttonupdown : int
            Mouse.ButtonWait ("down", x, y, buttonnumber, buttonupdown)
            if x >= maxx div 2 - 95 and x = maxy - 245 and y = maxx div 2 + 5 and x = maxy - 245 and y = 100 and tx (a) = 95 and x = 255 and y = 145 and x = 255 and y = 195 and x = 255 and y = 245 and x = 255 and y = 295 and x = 255 and y = 345 and x = 255 and y = 395 and x = 255 and y = 445 and x = 255 and y = 495 and x = 255 and y = 545 and x = 255 and y = 95 and x = 205 and y = 145 and x = 205 and y = 195 and x = 205 and y = 245 and x = 205 and y = 295 and x = 205 and y = 345 and x = 205 and y = 395 and x = 205 and y = 445 and x = 205 and y = 495 and x = 205 and y = 545 and x = 205 and y = 195 and x = 155 and y = 245 and x = 155 and y = 295 and x = 155 and y = 345 and x = 155 and y = 395 and x = 155 and y = 445 and x = 155 and y = 97 and ord (let) = 107 and ord (let) = 117 and ord (let)  96
            end if
        end loop

        %Release
        if ord (let) >= 97 and ord (let) = 107 and ord (let) = 117 and ord (let) = maxx div 2 - 95 and x = maxy - 245 and y = maxx div 2 + 5 and x = maxy - 245 and y = 100 and nx = 95 and x = 255 and y = 145 and x = 255 and y = 195 and x = 255 and y = 245 and x = 255 and y = 295 and x = 255 and y = 345 and x = 255 and y = 395 and x = 255 and y = 445 and x = 255 and y = 495 and x = 255 and y = 545 and x = 255 and y = 95 and x = 205 and y = 145 and x = 205 and y = 195 and x = 205 and y = 245 and x = 205 and y = 295 and x = 205 and y = 345 and x = 205 and y = 395 and x = 205 and y = 445 and x = 205 and y = 495 and x = 205 and y = 545 and x = 205 and y = 195 and x = 155 and y = 245 and x = 155 and y = 295 and x = 155 and y = 345 and x = 155 and y = 395 and x = 155 and y = 445 and x = 155 and y  96
            end if
        end loop

        %Used Letter
        for a : 1 .. 26
            if let = used (a) and letters (a) not= chr (42) then
                locate (5, 1)
                put ""
                letters (a) := chr (42)
                %Wrong Letter
                if index (words (random), let) = 0 then
                    counter += 1
                end if
            elsif let = used (a) and letters (a) = chr (42) then
                locate (5, 1)
                put "You have already used this letter, please choose another one!!"
            end if
        end for

        %Hangman face
        if counter = 1 then
            drawfilloval (735, 355, 15, 15, 89)
        elsif counter = 2 then
            drawfilloval (728, 357, 3, 3, black)         % left eye
        elsif counter = 3 then
            drawfilloval (742, 357, 3, 3, black)         %right eye
        elsif counter = 4 then
            drawarc (735, 345, 5, 5, 20, 160, black)         %mouth
            %Hangman body
        elsif counter = 5 then
            drawline (735, 340, 735, 280, black)
            Draw.Text ("Help me please!", 795, 330, Font.New ("serif:16:bold"), 40)
        elsif counter = 6 then
            drawline (735, 310, 765, 340, black)         %right arm
            Draw.Text ("Help me please!", 795, 330, Font.New ("serif:16:bold"), colo)
            Draw.Text ("Help me!", 795, 330, Font.New ("serif:16:bold"), 40)
        elsif counter = 7 then
            drawline (735, 310, 705, 340, black)         %left arm
        elsif counter = 8 then
            drawline (735, 280, 765, 250, black)         %right leg
            Draw.Text ("Help me!", 795, 330, Font.New ("serif:16:bold"), colo)
            Draw.Text ("Help! Help!", 795, 330, Font.New ("serif:16:bold"), 40)
        elsif counter = 9 then
            drawline (735, 280, 705, 250, black)         %left leg
        end if

        %Right letter
        for a : 1 .. length (words (random))
            if let = words (random) (a) then
                dash (a) := let
            end if
        end for

        %Draw Dashes
        locate (8, 15)
        for a : 1 .. length (words (random))
            put dash (a) : 3, " " ..
        end for

        %Right word checking
        for a : 1 .. length (words (random))
            right += index (dash (a), "_")
        end for

        %Exits
        letter := 0
        nx := 0
        exit when right = 0
        right := 0
        exit when counter = 9
    end loop

    %Play again
    delay (1000)
    cls
    Draw.Text ("Would you like to play again?", maxx div 2 - 130, maxy - 100, Font.New ("serif:16:bold"), 56)
    drawbox (maxx div 2 - 100, maxy - 250, maxx div 2, maxy - 200, black)
    drawfillbox (maxx div 2 - 95, maxy - 245, maxx div 2 - 5, maxy - 205, grey)
    Draw.Text ("Yes", maxx div 2 - 75, maxy - 235, Font.New ("serif:24:bold"), black)
    drawbox (maxx div 2 + 100, maxy - 250, maxx div 2, maxy - 200, black)
    drawfillbox (maxx div 2 + 95, maxy - 245, maxx div 2 + 5, maxy - 205, grey)
    Draw.Text ("No", maxx div 2 + 30, maxy - 235, Font.New ("serif:24:bold"), black)

    %Choice to Play Again
    choice := ""
    if counter = 9 then
        fork lost
        playagain
    elsif word = words (random) or right = 0 then
        fork won
        playagain
    end if

    exit when choice = "n"
    counter := 0
    cls
end loop

-----------------------------------
we64
Mon Jan 26, 2004 8:33 pm


-----------------------------------
What the hack, I think there are some problems in the forum. It showed me an error when I tried to post with code function, but it posted... just weired... anyway, use the last one that I posted just in case...

-----------------------------------
jonos
Mon Jan 26, 2004 8:44 pm


-----------------------------------
that's cool, the keyboard and the comments are cool.

-----------------------------------
sport
Mon Jan 26, 2004 9:45 pm


-----------------------------------
Great program, just make thw screen a bit smaller, it is too large

-----------------------------------
shorthair
Tue Jan 27, 2004 6:09 am


-----------------------------------
okay ,the first one you posted i had to change to work , but this one is muc hbettre you mark gets raised to a 7.5/10

-----------------------------------
AsianSensation
Tue Jan 27, 2004 10:59 am


-----------------------------------
What the hack, I think there are some problems in the forum. It showed me an error when I tried to post with code function, but it posted... just weired... anyway, use the last one that I posted just in case...

yeah, i fixed the tag issues (who said I don't do enough work? cough cough dodge cough cough)

-----------------------------------
we64
Tue Jan 27, 2004 9:38 pm


-----------------------------------
Thanks for fixing the error

-----------------------------------
Paul
Tue Jan 27, 2004 10:52 pm


-----------------------------------
dude, that avatar is crazy, looks like he's been hit downlow

-----------------------------------
we64
Tue Jan 27, 2004 11:16 pm


-----------------------------------
:D Oh yeah that is crazy DIRK NOWITZKI :D

-----------------------------------
we64
Wed Feb 04, 2004 6:28 pm


-----------------------------------
I updated my buttons, so you guys can take a look and give me some suggestions... :D

-----------------------------------
Paul
Wed Feb 04, 2004 6:32 pm


-----------------------------------
The button releases even without me releasing the mouse button, but I like how the right mouse button works too, ( or is that always the case?) I tested that out, and it turns out Turing mouse stuff doesnt care if its right or left mouse button.  good job.

-----------------------------------
we64
Wed Feb 04, 2004 6:40 pm


-----------------------------------
I think the mouse buttons are depends on how do you make it, it will have different results by using different ways...

-----------------------------------
Dan
Wed Feb 04, 2004 9:51 pm


-----------------------------------
not bad at all. i like how u did the letter layout. alougth there was one wired thing, once i restared the game it killed the gui of msnm witch i had ruing at the same time and the font chaged in the game, ROFL. alougth i think that is a bug in turing's GUI rather then your game.

have some bits++;
