PrettyPrint

Sunday, 27 January 2013

Creating The Game - 27/01/2013

Today I will be showing some of the simple code that I have written within for the game, but first I will be discussing what was spoken about in the weekly group meeting on Saturday. This week Stephen had completed some of the tiles that I am going to be using within the creation of the game, the tiles we decided are going to be 32x32 giving Stephen a big enough space to create something that looks aesthetically pleasing yet still fits the retro genre that we are aiming for. Sam has given me a sample of the level music that he is creating and we decided that it did not fit the sci-fi style techno music that we decided that should have been created, because of this he is going back and changing this music slightly to give it that feel that we would like. Andy is progressing well creating designs for his flash animations and poster that he is going to be creating. Once again I feel the the group is progressing in the right direction with progress being made each week.

I have been playing around with the Slick2D package this week and have got the very basic layout for the games code setup now. This will allow me to keep the code nicely structured and cleaner, it will also allow the game to run once the code has been written and compiled. The code that I have written this week after reading the documentation and looking at some basic examples of game code is :

import org.newdawn.slick.*;

public class SlickTest extends BasicGame {
 
 public SlickTest() {
  super("Jetson's Journey || EPQ Game");
 }

  public void render(GameContainer gc, Graphics g) throws SlickException {
  
 }

  public void init(GameContainer gc) throws SlickException {

  }

  public void update(GameContainer gc, int arg1) throws SlickException {

  }

  public static void main(String[] args) throws SlickException {
  AppGameContainer app = new AppGameContainer(new Game(), 1280, 960, false);
  app.start();
 }


The code above, denoted by the bold and italics, is the basic structure of a Slick2D game, the render method will be used to render assets onto the screen once I have imported them into the project, the init method will initialise everything needed within the game once the game starts this includes all variables, art assets and sound assets, the update method will be the section of code that will update the game logic making everything within the game like movement, collision and collecting coins possible. The last section of code, the main method is what initialises the whole game creating the game window and starting the game code running.

No comments:

Post a Comment