From 9b87de6625fd152cd69fbbe402de054cf1314a6e Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Tue, 27 Jan 2009 14:34:24 -0500 Subject: Converted GameCharacter's graphic store method Previously, GameCharacter (HeroEvent's backend) stored it's graphic as a graphic/offset combination. However, the EventGraphic class is the correct way to store it. --- src/com/fourisland/fourpuzzle/GameCharacter.java | 19 ++++++------------- .../fourpuzzle/gamestate/mapview/event/HeroEvent.java | 8 +++----- 2 files changed, 9 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/com/fourisland/fourpuzzle/GameCharacter.java b/src/com/fourisland/fourpuzzle/GameCharacter.java index da0ee9e..8557fef 100644 --- a/src/com/fourisland/fourpuzzle/GameCharacter.java +++ b/src/com/fourisland/fourpuzzle/GameCharacter.java @@ -5,6 +5,9 @@ package com.fourisland.fourpuzzle; +import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; +import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.EventGraphic; + /** * * @author hatkirby @@ -45,24 +48,14 @@ public class GameCharacter { this.inParty = inParty; } - private String graphic = "blank"; - public String getGraphic() + private EventGraphic graphic = new BlankEventGraphic(); + public EventGraphic getGraphic() { return graphic; } - public void setGraphic(String graphic) + public void setGraphic(EventGraphic graphic) { this.graphic = graphic; } - - private int graphicOffset = 0; - public int getGraphicOffset() - { - return graphicOffset; - } - public void setGraphicOffset(int graphicOffset) - { - this.graphicOffset = graphicOffset; - } } diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java index 6e8c359..d488e7d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java @@ -66,14 +66,12 @@ public class HeroEvent implements Event { } } - /* TODO Change the specification of GameCharacter - * to require an EventGraphic instead of a graphic name - * and offset - */ GameCharacter toDraw = Game.getSaveFile().getParty().getLeader(); if (!toDraw.getGraphic().equals("blank")) { - g.drawImage(CharSet.getCharSet(toDraw.getGraphic()).getImage(toDraw.getGraphicOffset(), direction, animationStep), x, y, null); + toDraw.getGraphic().setDirection(direction); + toDraw.getGraphic().setAnimationStep(animationStep); + g.drawImage(toDraw.getGraphic().getImage(), x, y, null); } } -- cgit 1.4.1