lior.shay
|
Posted: Sat Dec 15, 2012 5:27 pm Post subject: 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 <= 350 then
letter += 1
drawbox (90 + z, 150, 140 + z, 200, black)
drawfillbox (95 + z, 155, 135 + z, 195, grey)
Draw.Text (lettersIII (letter), 105 + z, 160, Font.New ("Algerian:22"), 56)
end if
z += 50
end for
var phrase : string
%Draw Dash
locate (8, 15)
for a : 1 .. length (words (random))
put dash (a) : 3, " " ..
end for
%Output
loop
loop
if Mouse.ButtonMoved ("down") then
var buttonnumber, buttonupdown : int
Mouse.ButtonWait ("down", x, y, buttonnumber, buttonupdown)
if x >= 95 and x <= 135 and y >= 255 and y <= 295 then
let := "a"
put "A"
elsif x >= 145 and x <= 185 and y >= 255 and y <= 295 then
let := "b"
put "B"
elsif x >= 195 and x <= 235 and y >= 255 and y <= 295 then
let := "c"
put "C"
elsif x >= 245 and x <= 285 and y >= 255 and y <= 295 then
let := "d"
put "D"
elsif x >= 295 and x <= 335 and y >= 255 and y <= 295 then
let := "e"
put "E"
elsif x >= 345 and x <= 385 and y >= 255 and y <= 295 then
let := "f"
put "F"
elsif x >= 395 and x <= 435 and y >= 255 and y <= 295 then
let := "g"
put "G"
elsif x >= 445 and x <= 485 and y >= 255 and y <= 295 then
let := "h"
put "H"
elsif x >= 495 and x <= 535 and y >= 255 and y <= 295 then
let := "i"
put "I"
elsif x >= 545 and x <= 585 and y >= 255 and y <= 295 then
let := "j"
put "J"
elsif x >= 95 and x <= 135 and y >= 205 and y <= 245 then
let := "k"
put "K"
elsif x >= 145 and x <= 185 and y >= 205 and y <= 245 then
let := "l"
put "L"
elsif x >= 195 and x <= 235 and y >= 205 and y <= 245 then
let := "m"
put "M"
elsif x >= 245 and x <= 285 and y >= 205 and y <= 245 then
let := "n"
put "N"
elsif x >= 295 and x <= 335 and y >= 205 and y <= 245 then
let := "o"
put "O"
elsif x >= 345 and x <= 385 and y >= 205 and y <= 245 then
let := "p"
put "P"
elsif x >= 395 and x <= 435 and y >= 205 and y <= 245 then
let := "q"
put "Q"
elsif x >= 445 and x <= 485 and y >= 205 and y <= 245 then
let := "r"
put "R"
elsif x >= 495 and x <= 535 and y >= 205 and y <= 245 then
let := "s"
put "S"
elsif x >= 545 and x <= 585 and y >= 205 and y <= 245 then
let := "t"
put "T"
elsif x >= 195 and x <= 235 and y >= 155 and y <= 195 then
let := "u"
put "U"
elsif x >= 245 and x <= 285 and y >= 155 and y <= 195 then
let := "v"
put "V"
elsif x >= 295 and x <= 335 and y >= 155 and y <= 195 then
let := "w"
put "W"
elsif x >= 345 and x <= 385 and y >= 155 and y <= 195 then
let := "x"
put "X"
elsif x >= 395 and x <= 435 and y >= 155 and y <= 195 then
let := "y"
put "Y"
elsif x >= 445 and x <= 485 and y >= 155 and y <= 195 then
let := "z"
put "Z"
end if
exit when ord (let) > 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 <= maxx div 2 - 5 and y >= maxy - 245 and y <= maxy - 205 then
choice := "y"
elsif x >= maxx div 2 + 95 and x <= maxx div 2 + 5 and y >= maxy - 245 and y <= maxy - 205 then
choice := "n"
end if
exit
end if
end loop
elsif word = words (random) or right = 0 then
fork victory
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 <= maxx div 2 - 5 and y >= maxy - 235 and y <= maxy - 205 then
choice := "y"
elsif x >= maxx div 2 + 95 and x <= maxx div 2 + 5 and y >= maxy - 235 and y <= maxy - 205 then
choice := "n"
end if
exit
end if
end loop
end if
[/b] |
|
|