Results 1 to 36 of 36

Thread: VB: Form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    VB: Form

    I was wondering how do you set it so that you can go from one form to another by clicking a command button (and how to make a server for an online game)

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    So you want something done that beginners can do easily as well as do something obviosuly way too advaced for you? Before I solve your problem, how much programming experience in VB do you have.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    still learning. started yesterday.

    I set one form to be visible but if i set the other to be not visible it shows an error ( i also have no idea how to make a server though). Can you tell me how to make an icon move also

  4. #4
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Let's do things one at a time here. The server stuff is way out of your league. Plus you must have some DirectX7 or DirectX8 and maybe some Winsock experience to do that. But if you want to learn your server stuff anyways, it's your funeral:

    http://216.5.163.53/DirectX4VB/TUT_DX8_DP.asp

    Now to get another form to appear after clicking a command button, assuming your first form's name is Form1 and the second form's name is Form2:

    Code:
    Private Sub Command1_Click()
    
        Form1.Hide
        Form2.Show
        
    End Sub
    And what Icon do you want moved anyways? You can't move the forms icon. But you can change it to something else.
    Last edited by Jacob Roman; Dec 9th, 2004 at 08:53 PM.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    one more question. is the form a map. if it is, how do i set the tiles

  6. #6
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    It's not a map per say. You pick the objects located on the toolbox to put on the form. Then you can place them anywhere within the form and put code within them for whatever events you need. Using pictureboxes or imageboxes as tiles is not the way to go. There are better ways.

    Now I see where you are getting at. You want to make games right away right?

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    it's kinda like that. It's just i dont knowhow to set the map size, properties for certain parts of the map (to make it stand up), and how to make a sprite that you can control and move

  8. #8
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    One thing though. The Form is NOT a map. It's just a window. So you do want to make games. Alright. Well you come to the right place and all, but you must know some basic programming concepts before moving on. Have you worked with the following yet?

    If..Then...Else statements
    For...Next statements
    Select Case
    Do...Loop
    While....Wend
    Do While...Loop
    Do Until....Loop
    Dim Your_variable_here As Data_Type
    With.....End With
    Option Explicit
    And
    Or
    Xor
    Type....End Type

    etc etc etc.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    only about one or two of those.

  10. #10
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Sheesh. Uhhhh......Um......Oh boy. Hehe. Yeah, before you learn how to make games, you must know how to program first. Start off small and work your way up. That's what I did. And it didn't take me long to make games. You want to see some that I made 4-5 years ago when I was a beginner?

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    sure! It's just i thought at first all i had to do when i got it was just make a map, add sprites and stuff, and it would be good (i thought it was as easy as an rpg maker).

  12. #12
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Oh it's waaaaaaaay better than an RPG maker. It's a programming language. And you can do a hell of a lot more than what some RPG maker can do, even full blown DirectX and OpenGL 3D games. Here's the really old games I've made located in this thread

    http://www.vbforums.com/showthread.php?t=315794

    My best old game I've ever written was Whack the Mole, located in that thread. My best new game I've ever....actually still working on game is Mortal Kombat vs Street Fighter. It's located here in MKvsSF.zip and plus it includes source code:

    www.angelfire.com/fl5/memorydll/index.html

    Ignor the pics, I solved those problems months ago. Plus it now has a skybox, and Ken animates. It's definitely not done yet though unfortunately but it's rocking! Be sure to delete the EXE file in there because it is old and has problems. The source code version of it has been highly updated with most problems fixed. Here are the controls:

    Mouse: Free Look (like playing a First Person Shooter)

    Keypad 8: Camera moves forward
    Keypad 5: Camera moves backward
    Keypad 4: Camera strafe left
    Keypad 6: Camera strafe right
    Keypad 7: Camera turns left
    Keypad 9: Camera turns right
    Keypad 1: Camera comes down
    Keypad 3: Camera goes up

    W: Wireframe
    S: Textured

    Spacebar: Snapshot

    Esc: Exits the program

    -/_ : Daytime
    =/+: Nighttime

    Left arrow: Ken walks forward
    Right arrow: Ken walks backward

    (Note: You can walk off the platform. Also note that Kens animation is not done. He only has one state of animation complete which is his fighting stance)

    I hope you enjoy it. And definitely learn how to program.

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    Good games (especcially spacewarp). Are there any special books i need. i want to make a 2d offline action rpg. so how do i make hp (do i use dim as.. then what? do i put dim as string)? and how do i make a chat

  14. #14
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Did you try my Good games which are Whack the Mole and my latest game I'm working on now Mortal Kombat vs Street Fighter? It has source code you can learn from. Although 4+ years ago (actually I have 8 years experience in VB) my code was always written sloppy and un-indented. Usually disorganized since I normally crammed it all in one form instead of using modules and class modules. Compare the code in MKvsSF to Whack the Mole and you'll see a major difference.

    As for books, to save you money for now, the internet is loaded with Visual Basic source code. Have you tried www.planet-source-code.com/vb ? You can find almost anything you want in there, even stuff on making RPG's. I highly recommend you learn how to program first though. Try looking at my MKvsSF game source code and you might be confused since it's pretty advanced. Looking at my Whack the mole source code on the other hand will help you out since it's pretty beginner yet really awesome!

    And you only want to declare something as string when you want to work with words, sentences, and external files like text files.

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    so does this site teach me how to program or how to make the game. if it doesnt teacht the first, where do i go to learn to program

  16. #16
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Here's a snapshot of my game MKvsSF:
    Attached Images Attached Images  

  17. #17
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    That was the site to teach you how to program. People upload their source code there all the time on pretty much anything. You search for whatever you want using the quick search located above, like a search engine only source code that's in their site.

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    no. i meant the code i put in so i can chat on the game

  19. #19
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Type "Chat" in the quick search on www.planet-source-code.com/vb and I guarentee you you'll find chat programs. But I'm warning you. It's too advanced for you. Even for me I think since I've never made a chat program or an online game....yet. But I did try. It was too hard. I plan on making MKvsSF a massive multiplayer online fighting game, but I still need to learn more on DirectPlay, which is a part of DirectX8 (as well as DirectX7).

  20. #20
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    You could try doing a google search on VB6 tutorials as well to learn how to program.

  21. #21
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: VB: Form

    Your best bet is to get a VB book and then go on from there

    it doesnt take long to learn the basics and then I recommend you do one thing at a time. If you are talking about doing an online game then that is a long way off. Its very complicated and you need a game first
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  22. #22
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB: Form

    Start off with a program that can display "Hello World!" on your form, when you click a button, and have another button to exit. if you get stuck, you can post your problem in the VB forum. Then, move on to harder things.
    You may find something useful that you want to make, like a telephone directory, or some simple game like Tic-Tac-Toe.
    As you successfully complete these programs, you will feel good about what you have learned. If you try to make a game right now, you will probably give up quickly out of disgust, and also, give up on programming altogether.
    It's not hard to learn, but once you start learning, you never stop!

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    well, while i'm here can i ask questions. I was wondering, i know how to maker something move, but dont know how to make it stop moving if it touches a spot, like the end of the area. what do i do

  24. #24
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Try this. Make a new project and add a picturebox to the form. Copy and paste this code:

    Code:
    Option Explicit 'This makes sure all variables have been declared.
    
    Private Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long) 'Needed for pausing between loops. This will be your first API you ever used.
    
    Private Sub Form_Activate()
    
        Dim Game_Active As Boolean 'Boolean is either always true or false.
        
        ScaleMode = 3 'Makes the form's coordinate system based on
                      'pixels rather than twips.
        
        Picture1.ScaleMode = 3 'Makes the picturebox's coordinate system based on
                               'pixels rather than twips.
        
        Game_Active = True
    
        While Game_Active = True
        
            DoEvents 'So the program doesn't lock up and allow events to happen.
            
            Sleep 15 'Keep it around 60 FPS. 1000 / 15 = 66.66
            
            Picture1.Left = Picture1.Left + 1 'For every frame, move the picturebox
                                               '1 unit to the right.
            
            If (Picture1.Left) >= 250 Then 'If it collides at 250
            
                Picture1.Left = 250 'Stay at 250
            
                Game_Active = False 'Exits the while loop.
            
            End If
            
        Wend
        
    End Sub
    I was gonna improve it, but I noticed that it maybe too hard for you to understand, so I left it like this to where it's readable for you.

  25. #25
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    And as for the "Hello World":

    Note: Do not use the Form_Load because it does code in there before the form's loaded and will refresh and clear the window. Use Form_Activate or Form_Paint instead.

    Code:
    Option Explicit
    
    AutoRedraw = True 'That way when the form loses focus and comes back, the drawing doesn't
                      'get erased.
    
    Private Sub Form_Activate()
    
        Print "Hello World"
    
    End Sub

  26. #26

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    how do i make a sprite ( the type i want to move)?

  27. #27
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Alright, but I'm warning you though, this is pretty advanced. I'm going to do this by memory since I don't have VB in front of me right now. So there might be a mistake or two.

    1) First of all, you will need to create a user defined data type called Sprite_Type:

    Code:
    Private Type Sprite_Type
    
         X As Long
         Y As Long
         Visible As Boolean
         Active As Boolean
    
         'This obviously needs more but for beginner's purposes, this is fine
         'for now.
    
    End Type
    2) Use the code I have above to serve as a base. Only this time I put the Sprite_Type in there.

    Code:
    Option Explicit 'This makes sure all variables have been declared.
    
    Private Type Sprite_Type
    
         X As Long
         Y As Long
         Visible As Boolean
         Active As Boolean
    
         'This obviously needs more but for beginner's purposes, this is fine
         'for now.
    
    End Type
    
    
    Private Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long) 'Needed for pausing between loops. This will be your first API you ever used.
    
    Dim Sprite As Sprite Type 'Make this an array if you want more sprites.
    
    Private Sub Form_Activate()
    
        Dim Game_Active As Boolean 'Boolean is either always true or false.
        
        ScaleMode = 3 'Makes the form's coordinate system based on
                      'pixels rather than twips.
        
        Picture1.ScaleMode = 3 'Makes the picturebox's coordinate system based on
                               'pixels rather than twips.
    
        Sprite.X = 0
        Sprite.Y = 0
        
        Sprite.Active = True
        Sprite.Visible = True
    
        Game_Active = True
    
        While Game_Active = True
        
            DoEvents 'So the program doesn't lock up and allow events to happen.
            
            Sleep 15 'Keep it around 60 FPS. 1000 / 15 = 66.66
    
            If Sprite.Active = True And Sprite.Visible = True Then
         
                 Picture1.Visible = True
      
            End If
            
            Sprite.X = Sprite.X + 1
    
            If (Sprite.X) >= 250 Then 'If it collides at 250
    
                Sprite.X = 250 'Stay at 250
            
                Game_Active = False 'Exits the while loop.
            
            End If
    
            Picture1.Left = Sprite.X 'For every frame, move the picturebox
                                               '1 unit to the right.
            
            Picture1.Top = Sprite.Y
    
            
        Wend
        
    End Sub

  28. #28

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    how do i make a user defined data thingy

  29. #29
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Look at 1)

    Plus I already included it in 2) so don't worry bout 1)

  30. #30

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    so i just paste that on the form?
    I'm kinda stupid to this right now, so i might as well ask the second question. how will this put my mecha icon on it

  31. #31
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    And definitely learn how to program first like we've been telling you. Read some books on VB (not VB.NET) at any bookstore. The internet has plenty of tutorials that will teach you how to program in VB6. And it's very easy to pick it up and learn how right away. Once you learn basic concepts of programming, continue to learn more as you progress.

    Now after that, you can now learn how to make games. There are numerous sites that will teach you the correct way to make video games in VB. We can't write the code for you. But we can lead you in the right direction and correct any problems you have. That's what these forums are for.

    You would want to be the author of your own program, not us. I mean think about it, if you were writing a book and had no idea on how to write it, you wouldn't want smarter people to fill in the blank pages for you would ya?

  32. #32
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Quote Originally Posted by Zenomori
    so i just paste that on the form?
    I'm kinda stupid to this right now, so i might as well ask the second question. how will this put my mecha icon on it

    Open up the properties window to the form. Goto Icon and click on the [...] button. It'll open up a dialog box. Find where your icon is and press the Ok button.

  33. #33

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    21

    Re: VB: Form

    yea, but i cant move that icon, and i want multiple icons on a map

  34. #34
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409

    Re: VB: Form

    Im not sure if youve been listing to what theve been telling you

    YOU NEED TO LEARN SIMPLE STUFF FIRST

    so go get your sefl a book on VB or VB.NET (i suggest vb.net but we wont go into that argument) And read it. Then we can help you with the hard stuff

  35. #35
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    Plus they are not icons you are refering to obviously now after reading what you are trying to say. What you are refering to are images (also known as pictures) based on file formats like bmp, jpg, jpeg, gif, etc., but not ico which are icon files. Totally different than image files man.

  36. #36
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: Form

    learn To Program First Like We've Been Telling You

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