summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/event
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-01-30 09:40:40 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-01-30 09:40:40 -0500
commitaa3d2a1e1d13b04a8c5801629e077668214bc3ff (patch)
tree91b616e4527259368f368c23ce2cf525544e5bf5 /src/com/fourisland/fourpuzzle/gamestate/mapview/event
parent58c3529f14de0e5142e0ba0927d3c7aa9288c799 (diff)
downloadfourpuzzle-aa3d2a1e1d13b04a8c5801629e077668214bc3ff.tar.gz
fourpuzzle-aa3d2a1e1d13b04a8c5801629e077668214bc3ff.tar.bz2
fourpuzzle-aa3d2a1e1d13b04a8c5801629e077668214bc3ff.zip
Added viewpoint scrolling
Now, maps can be larger than (20,15) and the map will scroll as the hero walks across the middle. However, Southward and Eastward middle-traversing appears to warp reality just a little and there are a few kinks that need to be straightened out.

Map layer caching has also been added because the lower and upper layers of a map never change, so they are cached after the first rendering.
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java28
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java1
3 files changed, 21 insertions, 11 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java index c0ea634..7e8dd0d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java
@@ -124,37 +124,43 @@ public abstract class AbstractEvent implements Event {
124 124
125 public int getRenderX() 125 public int getRenderX()
126 { 126 {
127 int x = (getLocation().x * 16) - 4; 127 return (getLocation().x * 16) - 4 + getMovingX();
128 128 }
129
130 public int getRenderY()
131 {
132 return (getLocation().y * 16) - 16 + getMovingY();
133 }
134
135 public int getMovingX()
136 {
129 if (isMoving()) 137 if (isMoving())
130 { 138 {
131 if (getDirection() == Direction.West) 139 if (getDirection() == Direction.West)
132 { 140 {
133 x -= (4 - moveTimer) * 4; 141 return -((4 - moveTimer) * 4);
134 } else if (getDirection() == Direction.East) 142 } else if (getDirection() == Direction.East)
135 { 143 {
136 x += (4 - moveTimer) * 4; 144 return (4 - moveTimer) * 4;
137 } 145 }
138 } 146 }
139 147
140 return x; 148 return 0;
141 } 149 }
142 150
143 public int getRenderY() 151 public int getMovingY()
144 { 152 {
145 int y = (getLocation().y * 16) - 16;
146
147 if (isMoving()) 153 if (isMoving())
148 { 154 {
149 if (getDirection() == Direction.North) 155 if (getDirection() == Direction.North)
150 { 156 {
151 y -= (4 - moveTimer) * 4; 157 return -((4 - moveTimer) * 4);
152 } else if (getDirection() == Direction.South) 158 } else if (getDirection() == Direction.South)
153 { 159 {
154 y += (4 - moveTimer) * 4; 160 return (4 - moveTimer) * 4;
155 } 161 }
156 } 162 }
157 163
158 return y; 164 return 0;
159 } 165 }
160} 166}
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java index 310c2a2..887e52b 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java
@@ -28,6 +28,9 @@ public interface Event {
28 public int getRenderX(); 28 public int getRenderX();
29 public int getRenderY(); 29 public int getRenderY();
30 30
31 public int getMovingX();
32 public int getMovingY();
33
31 public Direction getDirection(); 34 public Direction getDirection();
32 public void setDirection(Direction direction); 35 public void setDirection(Direction direction);
33 36
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java index 64ca592..c0c2c3b 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java
@@ -5,6 +5,7 @@
5 5
6package com.fourisland.fourpuzzle.gamestate.mapview.event; 6package com.fourisland.fourpuzzle.gamestate.mapview.event;
7 7
8import com.fourisland.fourpuzzle.gamestate.mapview.Map;
8import java.util.concurrent.Future; 9import java.util.concurrent.Future;
9 10
10/** 11/**