Jump to content

Where to start?

- - - - -

  • Please log in to reply
15 replies to this topic

#1
Devilb0y

Devilb0y

    Newbie

  • Members
  • PipPip
  • 10 posts
Ok, so this isn't a strictly Java based question but, given my ultimate goal with programming is game design, this seemed like a worthwhile language to start with.

I had no idea what programming was two days ago and probably still don't, but at least now I've actually followed a couple of tutorials and started to understand a (very) few things about the language.

My question to you guys is this:

If you were in my position, able to dedicate an hour a day to practising programming and you wanted to learn Java (and eventually C++) so that you could make games where would you start?

I know this might sound odd but there is a LOT of stuff on programming out there and I have no idea where to begin. At present i'm just following the tutorials on the Java website, but even these seem to assume a level of knowledge and familiarity with programming that I simply don't have.

I should add that I'm aware that languages like Virtual Basic are easier to learn but from what I've heard there's a danger of getting overly comfortable with a simplistic language and never making the leap to the tougher ones when you need to. This is a pit fall I'd like to try and avoid if possible.

Anyway, I've rambled enough. Any direction would be greatly appreciated.

#2
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
I would start with getting a book on the language that i would be intrested in to learn (in your case Java) and i wouldn't start right away with making games.
You should start with making some console applications which is basicaly typing things into the console
Example:
System.out.println("Hello World");

Following online tutorials is also a way to go but books in my opinnion is much better to learn from, A book writer gets paid and writing books is his job thats why he will try his absolute best to make people learn from the book he writes that why it can be better to start off with a book.

If you realy don't want to get a book i would recoment Oracle's tutorials over here:The Java™ Tutorials


Java is a great language to start with (in my opinnion) because learning C++ for example as a starting language may be little hard or start confusion. Java is little easier to understand.
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#3
Devilb0y

Devilb0y

    Newbie

  • Members
  • PipPip
  • 10 posts
Thanks for the response.

I've actually completed the Hello World tutorial with minimal fuss. It's when I got into the second and third of Oracle's tutorials when they start talking about Classes and Interfaces that I've encountered some problems. For instance: I still don't understand what the point of an interface is. If in order to tell a class to implement an interface's behaviour I need to define that class then I'm presented with an error saying that 'oldTelevision is already defined in unamed package' (oldTelevision being an example class). Now it's gone on to Primitive Data Types and I'm just like: woah, am I supposed to understand all this jargon you're throwing at me?

I get some of the basic principles but I think I might get a book to try and help explain things in a slightly less presumptuous style. Have you got any recommendations for a Java book for absolute beginners to programming?

#4
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
Personaly i would wait a little bit before getting into interfaces and such.. I would start learning variables, Making some small math problems and print them into the console.

I found some recomended books:
1. Java2 - The Complete Reference by: herbert shield
2. Thinking in Java (2nd Edition) by Bruce Eckel
3. Java How to Program (3rd Edition) by H.M. Deitel
4. The Complete Java 2 Certification Study Guide: Programmer's and Developers Exams (With CD-ROM) by Philip Heller.
5. Beginning Java 2 - Jdk 1.3 Edition: Jdk 1.3 Edition (Programmer to Programmer) by Ivor Horton
6. Java in a Nutshell (Flanagan)
7. Absolute Java (Savitch)
8. Java for Programmers (Deitel & Deitel)

The books i read myself were in swedish, Theese are books i found on the web when searching for good beginners books.

I think you forgot to put the second class inside a package.
Could you please post the code of the classes that there was errors in? I would like to see if i can help, Post the whole code of the 2 classes please.
(Also use the code tags by pressing the "#" button when making a post. And put your code inside the things that pops up in the posting window)
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#5
Devilb0y

Devilb0y

    Newbie

  • Members
  • PipPip
  • 10 posts
So you'd just stick to printing things to console until I can do that properly?

The most highly recommended Java beginners book seems to be Head First Java. Only problem is that most of these 'beginner' books are aimed at people with experience in other languages.

Anyway, here's the code I was struggling with:

/*

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */


/**

 *

 * @author Jimmy

 */


class oldTelevision {

            

    int On = 0;

    int Off = 0;

    int Volume = 0;

    int Brightness = 0;        

    

    void turnOn (int newValue) {

        On = newValue;

        Off = newValue - newValue;

    }

    void turnOff (int newValue) {

        Off = newValue;

        On = newValue - newValue;

    }

    void upVol (int increment) {

        Volume = Volume + increment;

    }

    void downVol (int decrement) {

        Volume = Volume - decrement;

    }

    void upBright (int increment) {

        Brightness = Brightness + increment;

    }

    void downBright (int decrement) {

        Brightness = Brightness - decrement;

    }


interface Television {

    

    // image on screen

    

void turnOn (int newValue);


void turnOff (int newValue);


void upVol (int increment);


void downVol (int decrement);


void upBright (int increment);


void downBright (int decrement);

    

}


class oldTelevision implements Television {


}




Error: class oldTelevision is already defined in unnamed package

#6
lespauled

lespauled

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 231 posts
  • Programming Language:C, C++, C#, JavaScript, PL/SQL, Delphi/Object Pascal, Visual Basic .NET, Pascal, Transact-SQL, Bash
I would divide my time between learning a language, like JAVA, C++, or whatever other language and coming up with a design for my game. As far as the design, you start with a very broad outline of how the game is to work. Then on a daily basis, get into more details. Break out environmental design from gameplay design. As you get deeper and deeper into that document, you will begin to realize that this document will become the basis of your program. In almost every instance, it will become the comments section for each method that handles that part of the game.

#7
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts

Devilb0y said:

So you'd just stick to printing things to console until I can do that properly?

The most highly recommended Java beginners book seems to be Head First Java. Only problem is that most of these 'beginner' books are aimed at people with experience in other languages.

Anyway, here's the code I was struggling with:

/*

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */


/**

 *

 * @author Jimmy

 */


class oldTelevision {

            

    int On = 0;

    int Off = 0;

    int Volume = 0;

    int Brightness = 0;        

    

    void turnOn (int newValue) {

        On = newValue;

        Off = newValue - newValue;

    }

    void turnOff (int newValue) {

        Off = newValue;

        On = newValue - newValue;

    }

    void upVol (int increment) {

        Volume = Volume + increment;

    }

    void downVol (int decrement) {

        Volume = Volume - decrement;

    }

    void upBright (int increment) {

        Brightness = Brightness + increment;

    }

    void downBright (int decrement) {

        Brightness = Brightness - decrement;

    }


interface Television {

    

    // image on screen

    

void turnOn (int newValue);


void turnOff (int newValue);


void upVol (int increment);


void downVol (int decrement);


void upBright (int increment);


void downBright (int decrement);

    

}


class oldTelevision implements Television {


}




Error: class oldTelevision is already defined in unnamed package

You can't create two classes with the same name inside the same file, Notice that the first class you created also were named oldTevelosion.. put the "implements Television" at the first time you created the class and remove class you created at the bottom.
This one:
class oldTelevision implements Television {


}

lespauled said:

I would divide my time between learning a language, like JAVA, C++, or whatever other language and coming up with a design for my game. As far as the design, you start with a very broad outline of how the game is to work. Then on a daily basis, get into more details. Break out environmental design from gameplay design. As you get deeper and deeper into that document, you will begin to realize that this document will become the basis of your program. In almost every instance, it will become the comments section for each method that handles that part of the game.
I think it would be better if he starts with focusing learning how programming works before getting into game developement. Its better in my opinnion to first learn a little bit about how programming / programs work then start making some text-based games.
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#8
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
You actually can have classes with the same name as long as they are not in the same file / folder.

It's stupid and you make it more complicated for yourself tho.

#9
lespauled

lespauled

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 231 posts
  • Programming Language:C, C++, C#, JavaScript, PL/SQL, Delphi/Object Pascal, Visual Basic .NET, Pascal, Transact-SQL, Bash
WHAAAAAAT???????

Off = newValue - newValue;


#10
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
As lespauled mentioned
You have theese two lines in your code:

On = newValue - newValue;

Off = newValue - newValue;

Which basicaly isn't doing anything.. Unless they are made just for yourself to understand your code. :)
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#11
Devilb0y

Devilb0y

    Newbie

  • Members
  • PipPip
  • 10 posts
Ha. That newValue - newValue bit was me messing around trying to achieve a result where, when the TV was switched on the 'Off' state would become the opposite of the 'On' state. Needless to say, this was probably not the way to achieve it.

So in terms of the error, if I replaced 'class oldTelevision implements Television' with 'oldTelevision implements Television' then would that overwrite the methods defined in the oldTelevision class, or simply use both when I attempted to use that class in an application?

#12
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts

Devilb0y said:

Ha. That newValue - newValue bit was me messing around trying to achieve a result where, when the TV was switched on the 'Off' state would become the opposite of the 'On' state. Needless to say, this was probably not the way to achieve it.

So in terms of the error, if I replaced 'class oldTelevision implements Television' with 'oldTelevision implements Television' then would that overwrite the methods defined in the oldTelevision class, or simply use both when I attempted to use that class in an application?

At the top of the whole code you linked you created a new class with all the methods inside of it.. Thats the one you will add the "implements Television" to.

The first class should look something like this:

Devilb0y said:

class oldTelevision implements Television {

int On = 0;
int Off = 0;
int Volume = 0;
int Brightness = 0;

void turnOn (int newValue) {
On = newValue;
Off = newValue - newValue;
}
void turnOff (int newValue) {
Off = newValue;
On = newValue - newValue;
}
void upVol (int increment) {
Volume = Volume + increment;
}
void downVol (int decrement) {
Volume = Volume - decrement;
}
void upBright (int increment) {
Brightness = Brightness + increment;
}
void downBright (int decrement) {
Brightness = Brightness - decrement;
}
}
[/CODE]
Notice that i put in "implements Television".
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users