Ergent NEed HELP ON HANGMAN GAME !!!!!!!&#

Website development, web apps, desktop/server apps, mobile apps and any other coding
Locked
C_daley98
Posts: 11
Joined: Tue Dec 13, 2005 10:37 am

Ergent NEed HELP ON HANGMAN GAME !!!!!!!&#

Post by C_daley98 »

i need to know how to make the words go on top of the boxes and anything unique u think i should include in this game while work is in progress.

heres what i have so far:
randomize
var infile, outfile : int
var word: string
var box,boxy:int
var answer:string
var num:int
var count:int:=0


box:=50
boxy:=350

drawfill (10, 10, 26, 26) % makes background grey

drawfillbox (500, 100, 510, 280, 4) % post
drawfillbox (450, 90, 550, 100, 4) % base
drawfillbox (500, 280, 430, 270, 4) % top
drawline (430, 270, 430, 240, 4) % rope

% opens the list of words
open : infile, "carlist.dat", get
assert infile > 0

randint(num,1,39)

loop
count:=count+1
% reads in words from data file
get : infile, skip % skips any white spaces

exit when count=num

get : infile, word


end loop


for a:1..length(word)
drawfillbox(box,boxy,box+30,boxy+10,4)
box:=box+50
end for


% for a:1..length(word)
% if answer=word(aa)
% case of aa


Archived topic from Iceteks, old topic ID:4570, old post ID:36403
User avatar
Death
Posts: 7919
Joined: Thu Sep 30, 2004 10:12 pm

Ergent NEed HELP ON HANGMAN GAME !!!!!!!&#

Post by Death »

C_daley98 wrote: i need to know how to make the words go on top of the boxes and anything unique u think i should include in this game while work is in progress.

heres what i have so far:
randomize
var infile, outfile : int
var word: string
var box,boxy:int
var answer:string
var num:int
var count:int:=0


box:=50
boxy:=350

drawfill (10, 10, 26, 26) % makes background grey

drawfillbox (500, 100, 510, 280, 4) % post
drawfillbox (450, 90, 550, 100, 4) % base
drawfillbox (500, 280, 430, 270, 4) % top
drawline (430, 270, 430, 240, 4) % rope

% opens the list of words
open : infile, "carlist.dat", get
assert infile > 0

randint(num,1,39)

loop
count:=count+1
% reads in words from data file
get : infile, skip % skips any white spaces

exit when count=num

get : infile, word


end loop


for a:1..length(word)
drawfillbox(box,boxy,box+30,boxy+10,4)
box:=box+50
end for


% for a:1..length(word)
% if answer=word(aa)
% case of aa
In order to get the word to appear on top of the boxes, you need to extract each letter from the word. For example, if the word is "DOG" you need to break it apart into D, O, G (Best to do this in a loop that executes for each letter, so 3 times). You need to check each letter of the word to what your user inputs (So for the first letter, check to see if your user entered D. If they didn't, check the next letter for a match, then the third....and so on). When you have found a match, you need to display the letter above the box. This can be a little tricky and you will need to use trial and error. If memory serves me correctly, you can combine graphics and text together in turing, but if you want to locate the text properly, you need to use the locatexy(x,y) command where X is the location in pixels on the X axis and Y is the location on the Y axis. Using this command, you can then output the letter at whatever locatexy() position is above your squares. I would personally suggest using a fixed Y value (Cause it probably won't change, you want your letters to all be at the exact same level). Use the X value to space in between your letters, so for the first letter, have it start at a certain x value, then display your next letter maybe 60 pixels afterwards (x + 60 in your locatexy command). Hope this helps you out a bit.



Archived topic from Iceteks, old topic ID:4570, old post ID:36404
C_daley98
Posts: 11
Joined: Tue Dec 13, 2005 10:37 am

Ergent NEed HELP ON HANGMAN GAME !!!!!!!&#

Post by C_daley98 »

i'm not quite understanding your explanation could u fill in a bit of code for me?


Archived topic from Iceteks, old topic ID:4570, old post ID:36448
C_daley98
Posts: 11
Joined: Tue Dec 13, 2005 10:37 am

Ergent NEed HELP ON HANGMAN GAME !!!!!!!&#

Post by C_daley98 »

heres what i got so far i still need to get if the word isn't right then draw body parts.


randomize
var infile, outfile : int
var word : string
var line, liney : int
var answer : string
var num : int
var count : int := 0
var xspace : int
var incorect : int := 0

line := 50
liney := 350

drawfill (10, 10, 26, 26) % makes background grey

drawfillbox (500, 100, 510, 280, 4) % post
drawfillbox (450, 90, 550, 100, 4) % base
drawfillbox (500, 280, 430, 270, 4) % top
drawline (430, 270, 430, 240, 4) % rope

% opens the list of words
open : infile, "carlist.dat", get
assert infile > 0

randint (num, 1, 39)

loop
count := count + 1
% reads in words from data file
get : infile, skip % skips any white spaces

exit when count = num

get : infile, word


end loop


for a : 1 .. length (word)
drawline (line, liney, line + 30, liney + 0, 4)
line := line + 50
end for

put word

xspace := 21

loop

locate (2, 1)
color (26)
colorback (26)
get answer


for a : 1 .. length (word)

if answer = word (a) then
% 45 space
locatexy (xspace + 48 * a, 360)
color (0)
colorback (26)
put word (a) ..

end if

end for



end loop


Archived topic from Iceteks, old topic ID:4570, old post ID:36467
Locked