
-----------------------------------
lior.shay
Sat Dec 15, 2012 5:27 pm

put statements overlapping drawings
-----------------------------------
this is my code, and i dont know how to make it so it doesnt overlap, and also how to make the letters go into the right spot in the underlines. game made by me


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&
%%  Author : Lior Shaykevich                                                 &&
%%  File Name :  Hangman                                                     &&
%%  Project Name : Lior's HangMan Game                                       &&
%%  Creation Date : December 7 2012                                          &&
%%  Modified Date : December 14 2012                                         &&
%%  Description : This is a hangman game consisting of 4 categories and 20   &&
%%  words                                                                    &%
%%                                                                           &%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View.Set ("nobuttonbar")
View.Set ("graphics")
View.Set ("graphics:1000,600")
View.Set ("position:center,truemiddle")
var random, strike, right : int := 0
var word : string := ""
var choice : string := ""
var let : string := ""
var x, y, z, button, letter : int := 0
var name : string
var keyPress : array char of boolean
var lettersI : array 1 .. 10 of string := init ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")
var lettersII : array 1 .. 10 of string := init ("K", "L", "M", "N", "O", "P", "Q", "R", "S", "T")
var lettersIII : array 1 .. 6 of string := init ("U", "V", "W", "X", "Y", "Z")
var category : array 1 .. 20 of string := init ("movies", "Bands", "Video Games", "Cars", "movies", "Bands", "Video Games",
    "Cars", "movies", "Bands", "Video Games", "Cars", "movies", "Bands", "Video Games", "Cars", "movies", "Bands", "Video Games", "Cars")
var words : array 1 .. 20 of string := init ("Ted", "ACDC", "Call Of Duty", "BMW", "Titanic", "The beatles", "Grand Theft Auto",
    "Mercedes - Benz", "Skyfall", "Metallica", "Far Cry", "Audi", "Superbad", "Rolling Stones", "Mario", "Jeep", "Enemy at the gates", "Kiss", "Sonic", "Ferrari")
var counter : int := 0



%background%

Draw.FillBox (0, 0, maxx, maxy, 55)
Draw.FillStar (-500, -700, 1400, 540, 137)


%grass%
Draw.FillBox (0, 70, maxx, 0, 118)
Draw.DashedLine (0, 1, maxx, 1, drawDash, 47)
Draw.DashedLine (0, 10, maxx, 10, drawDashDot, 47)
Draw.DashedLine (0, 19, maxx, 19, drawDashDot, 47)
Draw.DashedLine (0, 28, maxx, 28, drawDashDot, 47)
Draw.DashedLine (0, 37, maxx, 37, drawDashDot, 47)
Draw.DashedLine (0, 46, maxx, 46, drawDashDot, 47)


%clouds%
Draw.FillOval (70, 450, 50, 20, 0)
Draw.FillOval (320, 500, 50, 20, 0)
Draw.FillOval (560, 450, 50, 20, 0)
Draw.FillOval (700, 350, 50, 20, 0)


%Text%
var intFont : int

intFont := Font.New ("BlackOakSTD:25:")

Font.Draw ("Welcome To Lior's Hangman game", 30, 300, intFont, 47)

Font.Draw ("Please press enter  your name to start", 67, 250, intFont, 47)
get name
%move to next screen%

loop
    Input.KeyDown (keyPress)
    if keyPress (KEY_ENTER) then
        cls
        exit

    end if
end loop


process victory
    choice := "n"
    for w : 1 .. 5
        Draw.Text ("Good Job, You Won!", maxx div 2 - 100, maxy div 2, Font.New ("serif:24:bold"), Rand.Int (1, 100))
        delay (100)
        exit when choice not= "n"
    end for
end victory


process failure
    choice := "n"
    for l : 1 .. 5
        Draw.Text ("Sorry :(, 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 (100)
        exit when choice not= "n"
    end for
end failure



Draw.FillBox (0, 0, maxx, maxy, 0)
locatexy (0, 590)

put name
drawfillbox (740, 170, 760, 410, 16)
drawfillbox (760, 390, 860, 410, 16)
drawfillbox (700, 160, 900, 180, 16)
drawfillbox (830, 390, 840, 358, 16)
drawarc (835, 345, 13, 13, 0, 360, 16)

randint (random,1 , 20)
var dash : array 1 .. length (words (random)) of string

for a : 1 .. length (words (random))
    dash (a) := "_"
end for

%Keyboard

for a : 1 .. 10
    %First Row
    drawbox (90 + z, 250, 140 + z, 300, black)
    drawfillbox (95 + z, 255, 135 + z, 295, grey)
    Draw.Text (lettersI (a), 105 + z , 260, Font.New ("Algerian:22"), 56)

    %Second Row
    drawbox (90 + z, 200, 140 + z, 250, black)
    drawfillbox (95 + z, 205, 135 + z, 245, grey)
    Draw.Text (lettersII (a), 105 + z, 210, Font.New ("Algerian:22"), 56)

    %Third Row
    if z >= 100 and z = 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  95
        end if
    end loop

end loop

for a : 1 .. length (words (random))
    if let = words (random) (a) then
        dash (a) := let
    end if
end for

locate (8, 15)
for a : 1 .. length (words (random))
    put dash (a) : 3, " " ..
end for

for a : 1 .. length (words (random))
    right := right + index (dash (a), "_")
end for

for i : 1 .. length (words (random))
    if let = words (random) (i) then
        dash (i) := let
    end if
end for




function CheckPhrase () : string
    var randomPhrase : int := Rand.Int (1, 20)

    if (randomPhrase = 1) then
        phrase := category (1)
    end if
    result phrase

end CheckPhrase


if index (words (random), let) = 0 then
    strike += 1
end if



if strike = 9 then
    fork failure
    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 + 95 and x = maxy - 245 and y = maxx div 2 - 95 and x = maxy - 235 and y = maxx div 2 + 95 and x = maxy - 235 and y 