Hello JGO,
I have a problem. I am making a game where when you press the space bar, it places a tile where the player is. The problem is, when I try to place more than one tile, it moves the existing tile (see below) instead of creating a new one. The way I place a tile is below:
public void placeSkyscraper(int skyscraperX, skyscraperY) {
tileX += skyscraperX // tileX is the x position of the skyscraper
tileY += skyscraperY // tileY is the y position of the skyscraper
}
The way I call the placeSkyscraper method is below:
if (keyCode == KeyEvent.VK_SPACE) {
s.placeSkyscraper(c.getTileX() + 1, c.getTileY() + 1); // c is the object I use for my player.
}
EDIT:
Also, I have this line that draws the skyscraper graphic:
g.drawImage(s.getSkyscraper, s.getTileX() * 45, s.getTileY() * 45, null);
Does anyone know what’s going on?
Thanks in advance,
-DarkCart