Computer Science Canada Help with a horse race program, please |
Author: | Robotnik [ Mon May 08, 2006 1:43 pm ] |
Post subject: | Help with a horse race program, please |
First off, if you dont have anything helpful or relevant to post, then dont post at all please. I am making a game for my grade 11 class in which I must have a horse race. The user puts in thier bet and chooses a horse to place it on and then the horses do a little race animation that differs each time. I just need some help or tidbits of code to start with, kind of a noob. |
Author: | pavol [ Mon May 08, 2006 3:09 pm ] |
Post subject: | |
well you can start off by declaring a variable for each of the horse speeds, an array would be the most efficient. then randomize a number for each of the horses which will act as the horse's speed. afterwards, it's easy, just have them move accross the screen at that randomized value, check who crosses the finish line first (or who's speed is the greatest), and compare to the user's guess. to make it more interesting though, you could have the horses' speeds change every so often. ![]() |
Author: | Darkmantis [ Tue May 09, 2006 10:43 am ] | ||
Post subject: | |||
here is a race program Ive been working on. This is only the .exe file because Im at school and I cant rightclick to zip suff so..ya. Ill also post the code.
|
Author: | Robotnik [ Wed May 10, 2006 10:12 am ] |
Post subject: | Freeze? |
freeze.Enabled = True What does freeze do? I keeps saying that the "freeze" variable isn't declared. |
Author: | Darkmantis [ Wed May 10, 2006 11:01 am ] |
Post subject: | |
freeze is one of my timers |
Author: | Robotnik [ Wed May 10, 2006 1:01 pm ] |
Post subject: | Question |
form1 : Module Global scoreb, scorey, scoreg, scorer, wins, Points1, Points2 Dont understand any of this stuff, it just shows up red and gives me errors. Sorry for all the questions I'm a real noob. |
Author: | Darkmantis [ Wed May 10, 2006 3:07 pm ] |
Post subject: | |
no its ok ill give U a bit of a tutorial, well for modules I use a global variable to declare that the variables I include in the code are able to be used in dfferent forms in the program and I use them a lot. this show you where you can add a module to your project/program ![]() righ click on form1 and click add and then module ![]() ![]() |
Author: | Robotnik [ Thu May 11, 2006 12:58 pm ] |
Post subject: | Mo questions. |
So I put all of my declarations in the module? And did you do anything else besides picture boxes for the cars and track? |
Author: | Darkmantis [ Thu May 11, 2006 1:06 pm ] |
Post subject: | |
I don't think so why? |
Author: | Robotnik [ Thu May 11, 2006 1:18 pm ] |
Post subject: | |
Just checking to see if the positions or size of the pic boxes had anything to do with it. Instead of putting something like "Global scoreb, scorey, scoreg, scorer, wins, Points1, Points2 " could I just do something like: Option Explicit Private scoreb As Integer Private scorey As Integer Private scoreg As Integer Private scorer As Integer Private wins As Integer Private points1 As Integer Private points2 As Integer to declare the variables? |
Author: | cool dude [ Thu May 11, 2006 2:45 pm ] |
Post subject: | |
u can but then the variables will be private. if u want to do it like that then say public |
Author: | Darkmantis [ Thu May 11, 2006 5:04 pm ] |
Post subject: | |
wow Ive never seen such code before *twich* must write down for further inspection *twich* |
Author: | Robotnik [ Fri May 12, 2006 1:10 pm ] |
Post subject: | Declarations |
Are all of your declarations inside the module itself? Or better yet, what do you have in the madule? I'm just a bit confused I havent used modules yet. |
Author: | Darkmantis [ Fri May 12, 2006 2:40 pm ] |
Post subject: | |
Basically Points1 and Points2 is the number of points the person has and all the score things is just what I use to keep track of how many wins each car has. Scorer is the score for red, scorey is the score for yellow and so on.. and the wins variable is just declaring a text box so I can transfer text to it to show who won that round ![]() |
Author: | Robotnik [ Mon May 15, 2006 11:28 am ] |
Post subject: | |
If its not too much trouble, or if its not against the rules, could you post your VB files so I can take a look at them. I'm not going to use them word for word or anything, theres just a few more things I need to figure out before I can finish and it would be easier to look rather than going back and forth. Thanks for all the help so far by the way it has really benefited me. |
Author: | Darkmantis [ Mon May 15, 2006 11:53 am ] |
Post subject: | |
no problem, Ill post the program but it'll take some time because im at school and the school computer dont have winzip ![]() ![]() ![]() |
Author: | Darkmantis [ Mon May 15, 2006 12:23 pm ] |
Post subject: | |
I didnt want to wait so I found a online storage to put the files on hers the link: http://www.box.net and the login info is as follows: user : darkmantis3000@hotmail.com password : goodandy go into the storage and click all the items you need to download dont worry about anything its just a account I threw together just for this occasion ![]() |
Author: | Robotnik [ Wed May 17, 2006 12:05 pm ] |
Post subject: | |
Doesn't work, says 'Retained' is an invalid key when I try to load the Carace.vbp. |
Author: | Brightguy [ Wed May 24, 2006 3:27 pm ] |
Post subject: | Re: Help with a horse race program, please |
The 'Retained' key is used in VB6... However, VB5, rather than ignoring keys it doesn't recognise, refuses to load the project. Open the file in a text editor, remove the "Retained=0" line, and the project will open fine. |