diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-01-27 14:34:24 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-01-27 14:34:24 -0500 |
commit | 9b87de6625fd152cd69fbbe402de054cf1314a6e (patch) | |
tree | 4c3a63d3009e2adbd0855c36b237afcc2e936aa7 /src | |
parent | 9ca53b553cfaf488f7e8e678721bf9e655fa377e (diff) | |
download | fourpuzzle-9b87de6625fd152cd69fbbe402de054cf1314a6e.tar.gz fourpuzzle-9b87de6625fd152cd69fbbe402de054cf1314a6e.tar.bz2 fourpuzzle-9b87de6625fd152cd69fbbe402de054cf1314a6e.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/fourisland/fourpuzzle/GameCharacter.java | 19 | ||||
-rw-r--r-- | src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java | 8 |
2 files changed, 9 insertions, 18 deletions
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 @@ | |||
5 | 5 | ||
6 | package com.fourisland.fourpuzzle; | 6 | package com.fourisland.fourpuzzle; |
7 | 7 | ||
8 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; | ||
9 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.EventGraphic; | ||
10 | |||
8 | /** | 11 | /** |
9 | * | 12 | * |
10 | * @author hatkirby | 13 | * @author hatkirby |
@@ -45,24 +48,14 @@ public class GameCharacter { | |||
45 | this.inParty = inParty; | 48 | this.inParty = inParty; |
46 | } | 49 | } |
47 | 50 | ||
48 | private String graphic = "blank"; | 51 | private EventGraphic graphic = new BlankEventGraphic(); |
49 | public String getGraphic() | 52 | public EventGraphic getGraphic() |
50 | { | 53 | { |
51 | return graphic; | 54 | return graphic; |
52 | } | 55 | } |
53 | public void setGraphic(String graphic) | 56 | public void setGraphic(EventGraphic graphic) |
54 | { | 57 | { |
55 | this.graphic = graphic; | 58 | this.graphic = graphic; |
56 | } | 59 | } |
57 | |||
58 | private int graphicOffset = 0; | ||
59 | public int getGraphicOffset() | ||
60 | { | ||
61 | return graphicOffset; | ||
62 | } | ||
63 | public void setGraphicOffset(int graphicOffset) | ||
64 | { | ||
65 | this.graphicOffset = graphicOffset; | ||
66 | } | ||
67 | 60 | ||
68 | } | 61 | } |
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 { | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | /* TODO Change the specification of GameCharacter | ||
70 | * to require an EventGraphic instead of a graphic name | ||
71 | * and offset | ||
72 | */ | ||
73 | GameCharacter toDraw = Game.getSaveFile().getParty().getLeader(); | 69 | GameCharacter toDraw = Game.getSaveFile().getParty().getLeader(); |
74 | if (!toDraw.getGraphic().equals("blank")) | 70 | if (!toDraw.getGraphic().equals("blank")) |
75 | { | 71 | { |
76 | g.drawImage(CharSet.getCharSet(toDraw.getGraphic()).getImage(toDraw.getGraphicOffset(), direction, animationStep), x, y, null); | 72 | toDraw.getGraphic().setDirection(direction); |
73 | toDraw.getGraphic().setAnimationStep(animationStep); | ||
74 | g.drawImage(toDraw.getGraphic().getImage(), x, y, null); | ||
77 | } | 75 | } |
78 | } | 76 | } |
79 | 77 | ||