Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PC Game I just created in VFP9 - Simple & Fun (English only)

Status
Not open for further replies.
So, I was in the mood of coding today, and I decided I want to make a quick game in VFP, which I saw something similar on an iPad recently. I thought to my self, I can make this in VFP... so, this morning, I decided to create this app in pure VFP.

The Concept:
User is presented with a random 56 words on a form that are related to each other (mostly now are synonyms). They appear in random order. Each word has an equivalent word.
User has to find the matching word and solve the entire puzzle in less time as possible.

Options/Features:
460 words and their synonyms
1- Start/Play: Starts a new game or resume a Paused Game.
2- Pause: User can pause the existing game (which will hide the board so user won't cheat) and will pause the timer.
3- Shuffle: User can shuffle the board. While in game mode, the user has the ability to shuffle the current words around.
4- Hint: If the user cannot find a word, user can click on the word in question, and then click on the Hint button which will help reveal the matching/equivalent/related word on the board (its like a cheating a little)
5- When the 2 words are matched, the words will change color to background of red and they are striked thru and an "check" icon will appear (so it is easy to keep track of completed words)


It is fun, challenging, and for sure helps the user expand their vocab and learn (maybe?) new words.

This game can be changed to Match, Antonyms, etc..

Layout:
The game is driven by a simple table (as you will see in the project) called WordTable.dbf
has 4 fields:
Word1
Word1Value
Word2
Word2Value

Baslically, the relation is that word1value = word2value. So, that can be chaned to plug in match, antonyms, geography, etc..et

I simply "google" a list of words and their synonyms and I built the table quickly.

All source codes included.


PS: I just built the game this morning. I am sure there are some bugs here and there.. though I tested it for the most part and I played it a little.

I Didn't do the following (though one can easily do that):
1- High score list (create a table with high score?)
2- Have a button for the scoreboard
3- Rating (example, if one solves the game in less than 300 seconds maybe show a 3 star icon, 301-500 2 stars, 500+ 1 star) etc..
4- Save an existing game
plus many more..


Source code:

Main Page of the App
mainpage.png


The Game board with words
play.png


Hint
hint.png


Shuffling the board
shuffle.png


Hope you find it fun!!

Long live the Fox!!!!

Ez Logic
Michigan
 
I mean to say, game can be modified to plug in "Math" (not matched) :)

Basically, anytime you have 2 words related (whatever they are), you can use them in this game. Simply expand the Table.

Evern better, you can create a Category (Science, Synonyms, Antonyms, Math, Geography) and have a Category field.
On the main page, have the user click on a category, and the words based on the category will appear.

You just have to create the list of the words (Google can help I guess) :)


Ez Logic
Michigan
 
Well done

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
You have one error about PATHs you won't see on your development computer most probably about finding the wordlist.dbf. That can be ignored and then the game works, but I see some output to the form canvas in the back of controls.

How about putting it on GitHub or Codeplex?

Bye, Olaf.
 
To be more precise about the path/file not found error, if you unzip the game to a drive root there is no error, eg it works within X:\VFPGame\. If you install to X:\vfp\VFPWordGame\ you get error 202 invalid path or filename.

That's because of your code

SET DEFAULT TO \VFPWordGameSET PATH TO \VfPWordGame\;\VFPWordGame\Data\;\VFPWordGame\Forms\;\VFPWordGame\Images\;\VFPWordGame\Classes
Either don't SET DEFAULT at all or make use of SYS(16) to determine the EXE location and CD there to override a Working Directory a user may set in a lnk.

Then set relative paths as .\Data, .\Forms etc.

Bye, Olaf.



 
Thanks Olaf!! Yes, indeed what you said makes perfect sense.

Couple of questions:

1- When the user clicks Pause. What do you think is the best way to stop the timer (which I do by doing thisform.Paused = .t.) and then the timer's interval event just returns.. however, when the user clicks Play (to resume), I need the stop watch to continue from where it left + the elapsed...

2- I want to make 3 level, as 56 buttons is bit hard. I am thinking of making 3 levels. so:
level 1 (easy): 18 buttons (9 words + 9 synonyms)
level 2 (medium): 28 buttons (14 + 14 words)
level 3 (expert): 56 buttons (28 + 28 words , current mode now)

so, if the user clicks on any level, this is what I am thinking:

Create 3 different containers: CntrEasy, CntrMedium, CntrExpert.
Each container would have the appropriate button count.

based on the level clicked, I show the appropriate container and hide the other 2.

in the NewGame() method, I just wrap the code with:
Code:
lcContainer = thisform.Level  && passed by the click of the level mode..

with lcContainer
... 
... 
code of the newGame() method here
EndWith

You think there would be a better approach?

Maybe Based on the count, remove the # of buttons using RemoveObject(), Resize the width height of each button, and center them on the form?

seems like the container method (3 containers, 1 per level) is easier.. not sure if it is the better approach though.

Ez Logic
Michigan
 
Olaf, I forgot to put:
set talk off
set echo off

(I have those by default in my dev IDE)

that solved the canvas issue.

Ez Logic
Michigan
 
Thanks,

yes, I added SET TALK OFF to the main prg, and set AllowOutput = .F., that was enough. Within the IDE there was no text echoed, I even wonder what in the Timer Eventwould cause that echoing, you set the label.caption only.

To pause a timer rather set it Enabled = .F. and continue with Enabled = .T., you'll get a jump in the time elapsed, that one would be a bit hard to solve. You'd need to record the pause times and subtract it from the unpaused times. That needs a cursor or array, you can't solve that by changing the formula alone.

In regard to levels, I'd perhaps let the container be empty and generate the buttons at runtime. You'd also need to clear buttons, if you start an easier game after a harder game. In the end the three containers might be easier, simply hide all and show one of them. Have a form property referencing the active game container and your code can be genericaly adressing the container via that form property.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top