Subscribe to Six's Game Programming Adventures        RSS Feed
***** 1 Votes

Object-Oriented Java Tile Engine

Icon 1 Comments
Iíve been continuing work on my Java tile engine. It is continuing to evolve as is my Java knowledge. Iíve been moving to an object-oriented tile engine. There is now a map class that represents a tile map and a layer class that represents a layer of the map since Iím making a layered tile engine. At the moment there are two layers: the base layer that defines the ground and a second layer which is a decoration layer. In the future I will be moving to an unlimited, in theory, number of layers but one step at a time though. I also created a class that represents a tile set and a class for a camera that controls scrolling the map. I also created a couple utility classes. The first is used in drawing the tiles, a rectangle type class. The other represents a two dimensional vector. The vector class will continue to evolve as my game programming adventures continue.

Moving to use object-oriented programming in games is something I encourage others to do. Games can grow to be quiet complex and using objects makes them more manageable. There are times where you may want to break OOP though because following it strictly can hinder your development. In a strict OOP sense other objects shouldnít know about the internal workings of other object. You interact with other objects using a well defined public interface. When I say interface Iím not talking Java interfaces, Iím talking a well defined set of methods for interacting with the object. You could use a Java interface to define these methods that way others who look at your code, or even yourself months down the line, will understand the object better.

With the tile engine shaping up it is time to consider what I want to do with it. I might look at creating a simple RPG with it, my favorite genre of course. First though I need to work out some more mechanics when it comes to programming games with Java. Iím taking the first steps on my adventure and truly enjoying it. Thanks for reading and as always the code for this adventure.

JavaTileEngine.java
Spoiler


GamePanel.java
Spoiler


TileMap.java
Spoiler


TileLayer.java
Spoiler


TileSet.java
Spoiler


TileRectangle.java
Spoiler


Camera.java
Spoiler


Vector2.java
Spoiler

1 Comments On This Entry

Page 1 of 1

haiyun211 Icon

18 February 2012 - 04:18 PM
How does a Multilayer tile engine work?
0
Page 1 of 1

September 2014

S M T W T F S
  1 23456
78910111213
14151617181920
21222324252627
282930    

Recent Entries

Recent Comments

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)