Implamenting a code

Started by
13 comments, last by Alberth 7 years, 11 months ago

Thanks to Whom helped.

i find it very good start point right now.

Advertisement

I would like to suggest the LibGDX framework. It is a well documented game framework for Java and something like pong can be easily written with it in a view pages of code. Just download the LibGDX setup tool and Android Studio. Create a project with the setup tool and import it into Android Studio and start coding your game.

However, guessing from your posts I don't think you really know how to program in Java, otherwise you would probably not ask this question. Yes you might know some syntax but that is really not enough to start out. Try to learn the basics of java first, there are plenty of online sources, I am self-thought myself.

  1. Basics of java, knowing how to iterate a loop does not make you a coder.
  2. Know when and how to apply proven design patterns for your games.

There are plenty of tutorials for LibGDX where you will be creating a complete game but not really needed if you know how to read documentation. Pong is really simple and it is a great pick to start out. Pong, at it's core, requires only 3 classes.

  1. A Paddle class, here you put the input controls and perhaps a image to represent the paddle.
  2. A ball class, the ball needs to know about it's environment so store references for the obstacles (paddles) and the level area here. Whenever the ball makes contact with these you invert either X or Y.
  3. A screen class where you can show scores/lives and initialize objects from the previous 2 classes.

Good luck, whenever you are stuck with your code just post it here on the forums and I am sure you can find some help.

When it comes to design patterns, perhaps these aren't right for a newbie.

Design patterns are often misused. People go out of their way to find ways to fit their code to a design pattern, rather than looking at code that's already written and identifying patterns within. This leads to over engineered code that uses patterns for patterns sake. This is obvious when you see code with a class called Observer or such.

Learn to code first then worry about design patterns...

Learn to code first then worry about design patterns...

Thats why I put Java 101 prior to design patterns. Programming any game requires you to at least recognize design patterns since LibGDX and other frameworks will use them. Yes you could tell a man to just .addlistener(new Listener() { ... }) but I rather tell a man how to fish instead of catching one for them.

I disagree with the need to study design patterns early.

Many patterns have relations between several classes, eg state machine pattern, visitor pattern, adapter pattern, etc. You can only see them as pattern after you're really comfortable with a single class, and after you know inheritance and expressing relations between classes.

Until that time "static final void main(String[] args)" is just as much a pattern as "foo.addListener(new Listener() { .. })". A blurb of text with very little actual meaning that all examples use.

Even after you understand classes and their relations, you only need to recognize the patterns before you can use them. Recognizing is much easier, and does not need study, imho. Studying design patterns as subject on its own mostly adds names to the patterns, and extends the number of patterns that you recognize.

This topic is closed to new replies.

Advertisement