Results 1 to 3 of 3
  1. #1
    Newjav13 is offline Member
    Join Date
    Jul 2015
    Posts
    5
    Rep Power
    0

    Default How to make separate lines of code work in the main program.

    Hello,

    First off let me start by saying I tried registering at Java programming forums and it states it was hacked? Is that true?!

    Onto my actual question. I am a complete newbie to Java programming and I am catching on pretty quick. I have the Java for dummies book and im about 200 pages in. I may be getting ahead of myself because this may be something to do with classes but I cant continue the book not knowing this. I am wondering how do I create different lines of coding. For example, if I am making a side scroller video game, I need to assign a class to the character and objects all of that. But how do I actually input that into the main programming code? do I have to call that class after the menu code? So after the user would input their user name and password.. and press start, then it would be something like.. if user presses start, launch character class, launch background class etc etc...?

    I know it is probably way more complicated than that but its confusing me because I am pretty sure that all the code does not go into a single main document.


    If someone can enlighten me briefly that would be great, it doesn't need to be a super in depth explanation just something to help me understand so I don't have this question nagging me. I googled it and was unable to find it, I kept getting answers on how to make a new string of code lol.

    Thank you in advance!

  2. #2
    Artemia is offline Member
    Join Date
    May 2015
    Location
    Netherlands
    Posts
    39
    Rep Power
    0

    Default Re: How to make separate lines of code work in the main program.

    if you're just starting out, it's gonna be a while before you get to the point of making a game like that. it sounded like you're not entirely sure what a class is yet, which is kinda important in an object oriented language.
    I'm also pretty sure that something like that isn't covered in Java for Dummies, you would need a whole separate (set of) book(s) for game-design.

    I'm also pretty much a noob, but I can tell you that no not all code goes into one big main file.
    you will create hundreds of separate classes all in their own files and then use a lot of instances of those classes in your game.
    Like in mario there is probably one class file for the little mushroom mob but there can be 50 instances of that 1 mob in a level

  3. #3
    Newjav13 is offline Member
    Join Date
    Jul 2015
    Posts
    5
    Rep Power
    0

    Default Re: How to make separate lines of code work in the main program.

    Yeah I picked up a new book, one specifically for java and gaming.. Im learning a lot more already and it all makes sense considering this is what I want to learn java for. In the future I will get into other apps and everything like that but this is where I wanted to go. Thank you for the suggestion on a new book!! Im 100 pages in, learning about classes already. For anyone wondering what the book is its called.

    The beginners guide to android development ~ Written by James Cho.

Similar Threads

  1. Make my main program simple
    By unknown2 in forum New To Java
    Replies: 3
    Last Post: 02-20-2013, 12:28 AM
  2. Trying to make this code work...
    By hss02stir in forum New To Java
    Replies: 8
    Last Post: 11-12-2012, 05:43 PM
  3. Replies: 1
    Last Post: 06-05-2012, 04:31 PM
  4. How do I make my buttons work in the GUI of this code?
    By Interframe in forum AWT / Swing
    Replies: 3
    Last Post: 06-18-2011, 11:12 AM
  5. Should I separate my code into separate files?
    By Inks in forum New To Java
    Replies: 0
    Last Post: 03-26-2009, 12:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •