Skip to content

Commit 0767824

Browse files
committed
Added animation when the player stops
fixed a small bug that showed a small pixle of the players hand while the player moves in swimming state Added sprites for player standing still
1 parent 1bbafc7 commit 0767824

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

res/sprite_sheet.png

166 Bytes
Loading

src/com/redomar/game/entities/Player.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public void render(Screen screen) {
8686

8787
if (movingDir == 1) {
8888
xTile += 2;
89+
if (!isMoving || swim.isActive(swimType)){
90+
yTile -= 2;
91+
}
92+
} else if (movingDir == 0 && !isMoving || movingDir == 0 && swim.isActive(swimType)) {
93+
yTile -= 2;
8994
} else if (movingDir > 1) {
9095
xTile += 4 + ((numSteps >> walkingSpeed) & 1) * 2;
9196
flipTop = (movingDir - 1) % 2;

src/com/redomar/game/entities/efx/Swim.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,16 @@ public boolean[] swimming(boolean isSwimming, boolean isMagma, boolean isMuddy)
7878
swimminhType[2] = mud(isMuddy);
7979
return swimminhType;
8080
}
81+
82+
public boolean isActive(boolean[] swimmingType){
83+
if(swimmingType[0] == true){
84+
return true;
85+
}else if(swimmingType[1] == true){
86+
return true;
87+
}else if(swimmingType[2] == true){
88+
return true;
89+
} else {
90+
return false;
91+
}
92+
}
8193
}

0 commit comments

Comments
 (0)