Original Post
I have a class in Netbeans called Render. One method is the drawCreature:
public void drawCreature(Creature creature) {
Graphics g = jPanel1.getGraphics();
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.white);
g2.drawLine(creature.currentX, creature.currentY,
creature.currentX, creature.currentY);
} The method that calls it is the menu item action: private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
Creature mike = new Creature();
drawCreature(mike); My Creature class is fine, but it still won't draw a white dot to the screen where Mike should be located. Do I have any blatant errors? EDIT: Creature class, in case it helps.
public class Creature {
Creature parent;
int health, hunger, speed, power, color;
int currentX, currentY;
void Creature() {
health = 5;
hunger = 0;
speed = 5;
power = 5;
currentX = 15;
currentY = 15;
}
public void move(int coordX, int coordY) {
while (currentX != coordX) {
if (currentX < coordX) {
currentX++;
}
if (currentX > coordX) {
currentX--;
}
}
while (currentY != coordY) {
if (currentY < coordY) {
currentY++;
}
if (currentY > coordY) {
currentY--;
}
}
}
public void eat() {}
public void fight(Creature target) {}
public void mate(Creature target) {}
}