Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help with word ordering game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kanetix




PostPosted: Wed Jan 14, 2004 5:52 pm   Post subject: need help with word ordering game

I'm making a word ordering game which displays 10 words in random order, so that the user has to arrange it in alphabetical order, using the mouse( I didn't even get there yet), and the program has to repeat until the user quits. Currently I'm having the following major problems:


1)In the userInput screen (the one with the 10 words), even after clear screen with the title, the buttons are still there, just invisible. ( same thing happens in the goodbye screen)In this screen i need the exit button to appear but not the play button.

2) it seems that words repeat themselves after being randomized, how can i error trap it?

here's the code:

import GUI

%the words
var itemName : array 1 .. 10 of string :=
init ("family", "fireworks", "food", "friends", "giving", "happiness", "money", "new year", "red envelopes", "relatives")

% to randomize the words
var num : array 1 .. 10 of int

%the buttons
var name1 : string := "Play Game"
var name2 : string := "Exit"
var playbutton : int := 0
var exitbutton : int := 0

%introduction
proc title
cls
locate (1, 20)
put "Chinese New Year Word Ordering Game"
end title

proc pauseProgram
var reply : string (1)
locate (3, 1)
put "Press any key to continue..."
getch (reply)
end pauseProgram

proc intro
title
put "Arrange the words in alphabetical order"
pauseProgram
end intro

%mainMenu
proc mainMenu
title
end mainMenu

%game screen
proc userInput
title
for x : 1 .. 10
randint (num (x), 1, 10)
end for
for x : 1 .. 10
put (itemName (num (x)))
end for
end userInput

%goodbye screen
proc goodBye
title
locate (5, 1)
put "Play Again Next Time!"
end goodBye

%main program
intro

mainMenu
playbutton := GUI.CreateButton(200,5,10,name1,userInput)
exitbutton := GUI.CreateButton(300,5,10,name2,goodBye)

loop
exit when GUI.ProcessEvent
end loop

goodBye

This is due friday and i know i still have lots of problems with it.
So your help would be really appreciated..

thanks
Sponsor
Sponsor
Sponsor
sponsor
CjGaughan




PostPosted: Thu Jan 15, 2004 4:55 pm   Post subject: (No subject)

do the buttons being there really matter? you don't know they are there unless you click there.


maybe something you could try: drawing a white box (or whatever colour your background is going to be) over top of the boxes? I don't know too much about gui, so I couldn't say.
AsianSensation




PostPosted: Thu Jan 15, 2004 7:25 pm   Post subject: (No subject)

GUI.Dispose gets rid of the GUI buttons.

and see tony's (or McKenzie's) tutorial on how to get a random thing in a list without repeat.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: