/* (non-Javadoc) * @see org.jfge.engine.Updatable#update() */ @Override public void update() { // aiController.handle(fighter2, fighter1); fighter1.update(); fighter2.update(); collisionDetector.update(); arena.update(); }
/* (non-Javadoc) * @see org.jfge.engine.Renderable#render(java.awt.Graphics) */ @Override public void render(Graphics graphics) { /* * draw arena background should be done in renderer */ arena.render(graphics); /* * render fighters; */ fighter1.render(graphics); fighter2.render(graphics); }
@Override public void init() { if (this.parent == null) return; this.direction = parent.getDirection(); }
/* (non-Javadoc) * @see org.jfge.engine.Updatable#update() */ @Override public void update() { if (parent == null) return; if (direction == Sprite.RIGHT) { parent.setDx(HORIZONTAL); } else { parent.setDx(-HORIZONTAL); } if (parent.getDy() > 0) { parent.setDy(VERTICAL); } else { parent.setDy(-VERTICAL); } if (parent.getY() - parent.getHeight() < 0) { parent.setDy(VERTICAL); } if (parent.getY() + parent.getDy() > FLOOR) { parent.setDx(0); parent.setDy(0); parent.setY(FLOOR); parent.nextState(); } }