Results 1 to 6 of 6

Thread: Need help with my game

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    1

    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

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    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

  4. #4
    Addicted Member seditives's Avatar
    Join Date
    Jan 2011
    Location
    South of England
    Posts
    151

    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

  5. #5
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    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

  6. #6
    Addicted Member seditives's Avatar
    Join Date
    Jan 2011
    Location
    South of England
    Posts
    151

    Re: Need help with my game

    Quote Originally Posted by incidentals View Post
    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
  •  



Click Here to Expand Forum to Full Width