-
Jan 21st, 2012, 12:52 PM
#1
Thread Starter
New Member
Need help with my game
Hi, i am in grade 11 and my project is to make a game on visual basic 6,
in my game i have a character that can move around the screen and he has to kill incoming monsters and when he kills a monster the i have a label where the cash goes up everytime a monster is killed. When the player completes the level it asks the user if they want to go to the shop but how do i transfer the number (cash) from the label on the 1st form to a label on the 2nd form?
Thanks, Eric
-
Jan 21st, 2012, 02:53 PM
#2
Re: Need help with my game
Welcome to the forums
A few options, here are two:
1) Any control on any form can be referenced from another form
Code:
' in form2
MsgBox Form1.LblCash.Caption
2) Use a module and store the cash to a PUBLIC variable. Public variables within a module can be referenced/set from anywhere in your project
-
Jan 22nd, 2012, 05:44 AM
#3
Frenzied Member
Re: Need help with my game
if values are to be spread around the whole game
you should think about putting them somewhere with "global scope"
thats where everything can see them
so storing in a variable declared in the main module
means you just as for the variable reguardless of where you are
you can then simplify your score board and shorten the names you type when accessing them
highscore is easier to read and type than "the_arena_of_death.highscore_label.caption" wich is also a string and not a number BTW
does this make any sense to you?
here to help
-
Jan 22nd, 2012, 06:02 AM
#4
Addicted Member
Re: Need help with my game
You could also save the data to a .txt file this could give extra functionality to the game such as a score board.
to do this you would use the "Open/close commands"
I have done a similar course in programming course in the past and if this I a programming course you are doing, believe me you may think the game is awesome but what their really interested in is how many commands you have learned how to use since you started. I would chuck in a broad range of coding commands in this "game". but that's jut my view its your program after all.
A subtle thought that is in error may yet give rise to fruitful inquiry that can establish truths of great value. - Isaac Asimov
-
Jan 22nd, 2012, 07:28 AM
#5
Frenzied Member
Re: Need help with my game
the problem with chucking in loads of dross is it can show you donot understand the question
when we understand the question we can tune the solution to a small sleak thing
and games need speed not bloat
generate a document that holds snippets of codes that you used, improved and/or trashed and give reasons.
this will help you and impress you instructors
you can keep the code in a module in the program clearly mark for removal on compilation!
and remember to change the names of old subs ad functions to prevent clashes in the code
here to advise
-
Jan 22nd, 2012, 07:35 AM
#6
Addicted Member
Re: Need help with my game
Originally Posted by incidentals
generate a document that holds snippets of codes that you used, improved and/or trashed and give reasons.
yer sorry I should of further explained. incidentals is right you need to show every thing you have learned not just throught the program it self but through documentation.
but my point still stands, unless you are doing a game design course, they do tend give you game based project as games dont really have much limit and therefore you can show a multitude of skills. opposed to writing a program to add two numbers for example.
A subtle thought that is in error may yet give rise to fruitful inquiry that can establish truths of great value. - Isaac Asimov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|