There are many things I would love to know about how to make my engine and the game I have in mind is very heavily inspired by this lovely hell we call H&H

I am a very basic coder, and have just begun to delve into the depths of object oriented programming and the language of Java. I can post what I currently have for the base of loading my maps, (I hope it to be a scrolling isometric game like this, no map edges where another map needs to be loaded.) but I have no idea whether this will work, and I have a few questions about how to weave the syntax to do exactly what I intend it to.
- Code: Select all
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.net.*;
public class IsoEngine implements Runnable {
double totalWidth = (tile[n]*64); //width of one single tile is 64 pixels.
double totalHeight = (tile[n]*32); //height of one single tile is 32 piexels.
int WIDTH = getSize().width;
int HEIGHT = getSize().height;
int incrX = 64;
int incrY = 32;
public void DrawTile {
private Image image;
private URL getURL(String filename) {
URL url = null;
try {
url = this.getClass().getResource(filename)
}
catch (Exception e) { }
return url;
}
public void init() {
image = getImage(getURL("isograss(small).png"));
}
public void paint (Graphics g) {
Graphics2D g2d = (Graphics2D)g;
int width = getSize().width;
int height = getSize().height;
g2d.setColor (Color.BLACK);
g2d.fillRect(0, 0, getSize().width, getSize().height);
int TILE;
Tile[] tile = new Tile[TILE];
int currentTiles = 0;
tile.setX(WIDTH/2);
tile.setY(HEIGHT/2);
while (totalWidth < (getSize().width + 100) && totalheight < (getSize().height + 100) {
// + 100 to each to make sure there are no blank spots on the screen.
g2d.drawImage(image, (incrX*TILE), (incrY*TILE), this);
n++;
Sorry for that wall of text, but I can tell I'm already doing something wrong. (It's also not finished, this is just what I have as of right now.)
I would like it to generate the tiles until they reach the edge of the game screen, and +100 pixels to that so that there are not any blank spots on the visible screen. I don't quite understand the array system to count the amount of an object/image for Tile[] tile = new Tile[TILE]; anyone who understands Java better than I is welcome to comment, correct, finish, optimize, etc.
In case any of you were wondering I am learning most of this from my book Beginning Java Game Programming: Second Edition http://www.amazon.com/exec/obidos/ASIN/1598634763/bookpriceline-20/ref/
ALSO: Loftar & Jorb, please do not feel offended that I am advertising that I am making (more like "attempting") to make a game. I do not intend to steal player base, nor was I intending to advertise my development in the first place. I was hoping to find some guidance from experienced coders on where to go from the coding aspect. If anything, maybe when/if my game gets up and running, we could have sister sites
