Made moving walls smaller to be more fair #17. Moved Obstactles further back on openings #16. Fixed two bugs #15, #14. And made double jumping less frustrating #13.
This commit is contained in:
parent
35f5d4a79b
commit
c5f22f7f21
Binary file not shown.
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 258 KiB |
@ -46,7 +46,10 @@ class LoseMenuOverlay extends StatelessWidget {
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text("Main Menu"),
|
||||
child: Text(
|
||||
" Main Menu ",
|
||||
style: overlayText,
|
||||
),
|
||||
),
|
||||
),
|
||||
// ),
|
||||
@ -70,7 +73,10 @@ class LoseMenuOverlay extends StatelessWidget {
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text("Replay"),
|
||||
child: Text(
|
||||
" Replay ",
|
||||
style: overlayText,
|
||||
),
|
||||
),
|
||||
),
|
||||
// ),
|
||||
|
@ -64,7 +64,7 @@ class Platform extends MovingObject {
|
||||
PlatformState.right: right,
|
||||
PlatformState.single: single,
|
||||
},
|
||||
current: PlatformState.single,
|
||||
current: PlatformState.mid,
|
||||
);
|
||||
|
||||
sprite.changePriorityWithoutResorting(PLATFORM_PRIORITY);
|
||||
@ -112,14 +112,19 @@ class Platform extends MovingObject {
|
||||
bool hasLeft = (left.x - sprite.position.x).abs() < 1.9 * sprite.size.x;
|
||||
bool hasRight = (sprite.position.x - right.x).abs() < 1.9 * sprite.size.x;
|
||||
|
||||
if (hasLeft && hasRight) {
|
||||
sprite.current = PlatformState.mid;
|
||||
} else if (hasLeft && !hasRight) {
|
||||
sprite.current = PlatformState.right;
|
||||
} else if (!hasLeft && hasRight) {
|
||||
sprite.current = PlatformState.left;
|
||||
} else {
|
||||
sprite.current = PlatformState.single;
|
||||
// If the platform cannot be seen by the player.
|
||||
if (!((sprite.x >= 0 && sprite.x <= gameRef.size.x) ||
|
||||
(sprite.x + sprite.width >= 0 &&
|
||||
sprite.x + sprite.width <= gameRef.size.x))) {
|
||||
if (hasLeft && hasRight) {
|
||||
sprite.current = PlatformState.mid;
|
||||
} else if (hasLeft && !hasRight) {
|
||||
sprite.current = PlatformState.right;
|
||||
} else if (!hasLeft && hasRight) {
|
||||
sprite.current = PlatformState.left;
|
||||
} else {
|
||||
sprite.current = PlatformState.single;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ class PlatformHolder extends Holder {
|
||||
late Image r2;
|
||||
late Image o1;
|
||||
late Image o2;
|
||||
bool noTopObstaclesForNext = false;
|
||||
bool noMiddleObstaclesForNext = false;
|
||||
int timeSinceLastTopHole = 0;
|
||||
int timeSinceLastBottomHole = 0;
|
||||
|
||||
@ -91,6 +93,7 @@ class PlatformHolder extends Holder {
|
||||
remove(objects[2], objects[2].length - 2);
|
||||
|
||||
timeSinceLastTopHole = 0;
|
||||
noTopObstaclesForNext = true;
|
||||
}
|
||||
if (bottomChance > 30) {
|
||||
Platform start = objects[5].elementAt(objects[5].length - 10) as Platform;
|
||||
@ -112,6 +115,7 @@ class PlatformHolder extends Holder {
|
||||
remove(objects[5], firstToRemove);
|
||||
|
||||
timeSinceLastBottomHole = 0;
|
||||
noMiddleObstaclesForNext = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +133,13 @@ class PlatformHolder extends Holder {
|
||||
platform.row = level;
|
||||
gameRef.add(platform.sprite);
|
||||
objects[level].add(platform);
|
||||
if (level == 2 && noTopObstaclesForNext) {
|
||||
platform.prohibitObstacles = true;
|
||||
noTopObstaclesForNext = false;
|
||||
} else if (level == 5 && noMiddleObstaclesForNext) {
|
||||
platform.prohibitObstacles = true;
|
||||
noMiddleObstaclesForNext = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (gameRef.gameState.isPaused) {
|
||||
return;
|
||||
}
|
||||
previousState = runnerState;
|
||||
switch (event) {
|
||||
case "jump":
|
||||
previousState = runnerState;
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.jump;
|
||||
sprite.addEffect(MoveEffect(
|
||||
@ -94,6 +94,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (belowPlatform()) {
|
||||
break;
|
||||
}
|
||||
previousState = runnerState;
|
||||
sprite.clearEffects();
|
||||
if (level - 1 < 0) {
|
||||
break;
|
||||
@ -117,20 +118,24 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
));
|
||||
break;
|
||||
case "fall":
|
||||
previousState = runnerState;
|
||||
sprite.clearEffects();
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.fall;
|
||||
sprite.addEffect(getFallingEffect());
|
||||
break;
|
||||
case "kick":
|
||||
previousState = runnerState;
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.kick;
|
||||
break;
|
||||
case "run":
|
||||
previousState = runnerState;
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.run;
|
||||
break;
|
||||
case "float":
|
||||
previousState = runnerState;
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.float;
|
||||
sprite.addEffect(MoveEffect(
|
||||
@ -148,6 +153,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
));
|
||||
break;
|
||||
case "duck":
|
||||
previousState = runnerState;
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.duck;
|
||||
sprite.addEffect(MoveEffect(
|
||||
@ -163,6 +169,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
previousState = runnerState;
|
||||
sprite.clearEffects();
|
||||
level = 11;
|
||||
sprite.addEffect(MoveEffect(
|
||||
@ -179,6 +186,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
previousState = runnerState;
|
||||
sprite.clearEffects();
|
||||
level = 11;
|
||||
sprite.addEffect(MoveEffect(
|
||||
@ -195,6 +203,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
previousState = runnerState;
|
||||
sprite.clearEffects();
|
||||
level = 11;
|
||||
sprite.addEffect(MoveEffect(
|
||||
@ -324,6 +333,14 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
sprite.current = RunnerState.run;
|
||||
}
|
||||
|
||||
if (runnerState == "float" || runnerState == "double_jump") {
|
||||
if (onTopOfPlatform()) {
|
||||
updateLevel();
|
||||
sprite.clearEffects();
|
||||
event("run");
|
||||
}
|
||||
}
|
||||
|
||||
intersecting();
|
||||
sprite.update(dt);
|
||||
}
|
||||
@ -347,7 +364,11 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
}
|
||||
|
||||
bool belowPlatform() {
|
||||
Rect runnerRect = sprite.toRect();
|
||||
Rect runnerRect = Rect.fromLTRB(
|
||||
sprite.toRect().left,
|
||||
sprite.toRect().top,
|
||||
sprite.toRect().right - sprite.toRect().width / 2,
|
||||
sprite.toRect().bottom);
|
||||
bool belowPlatform = false;
|
||||
for (List<MovingObject> platformLevel in gameRef.platformHolder.objects) {
|
||||
for (MovingObject p in platformLevel) {
|
||||
|
@ -31,7 +31,7 @@ class Wall extends MovingObject {
|
||||
gameRef.blockSize *
|
||||
(gameRef.wallHolder.wall.width / gameRef.wallHolder.wall.height / 5) *
|
||||
2.0,
|
||||
gameRef.blockSize * 0.5,
|
||||
gameRef.blockSize * 0.35,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user