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(
|
child: const Padding(
|
||||||
padding: EdgeInsets.all(8.0),
|
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(
|
child: const Padding(
|
||||||
padding: EdgeInsets.all(8.0),
|
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.right: right,
|
||||||
PlatformState.single: single,
|
PlatformState.single: single,
|
||||||
},
|
},
|
||||||
current: PlatformState.single,
|
current: PlatformState.mid,
|
||||||
);
|
);
|
||||||
|
|
||||||
sprite.changePriorityWithoutResorting(PLATFORM_PRIORITY);
|
sprite.changePriorityWithoutResorting(PLATFORM_PRIORITY);
|
||||||
@ -112,6 +112,10 @@ class Platform extends MovingObject {
|
|||||||
bool hasLeft = (left.x - sprite.position.x).abs() < 1.9 * sprite.size.x;
|
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;
|
bool hasRight = (sprite.position.x - right.x).abs() < 1.9 * sprite.size.x;
|
||||||
|
|
||||||
|
// 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) {
|
if (hasLeft && hasRight) {
|
||||||
sprite.current = PlatformState.mid;
|
sprite.current = PlatformState.mid;
|
||||||
} else if (hasLeft && !hasRight) {
|
} else if (hasLeft && !hasRight) {
|
||||||
@ -122,4 +126,5 @@ class Platform extends MovingObject {
|
|||||||
sprite.current = PlatformState.single;
|
sprite.current = PlatformState.single;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ class PlatformHolder extends Holder {
|
|||||||
late Image r2;
|
late Image r2;
|
||||||
late Image o1;
|
late Image o1;
|
||||||
late Image o2;
|
late Image o2;
|
||||||
|
bool noTopObstaclesForNext = false;
|
||||||
|
bool noMiddleObstaclesForNext = false;
|
||||||
int timeSinceLastTopHole = 0;
|
int timeSinceLastTopHole = 0;
|
||||||
int timeSinceLastBottomHole = 0;
|
int timeSinceLastBottomHole = 0;
|
||||||
|
|
||||||
@ -91,6 +93,7 @@ class PlatformHolder extends Holder {
|
|||||||
remove(objects[2], objects[2].length - 2);
|
remove(objects[2], objects[2].length - 2);
|
||||||
|
|
||||||
timeSinceLastTopHole = 0;
|
timeSinceLastTopHole = 0;
|
||||||
|
noTopObstaclesForNext = true;
|
||||||
}
|
}
|
||||||
if (bottomChance > 30) {
|
if (bottomChance > 30) {
|
||||||
Platform start = objects[5].elementAt(objects[5].length - 10) as Platform;
|
Platform start = objects[5].elementAt(objects[5].length - 10) as Platform;
|
||||||
@ -112,6 +115,7 @@ class PlatformHolder extends Holder {
|
|||||||
remove(objects[5], firstToRemove);
|
remove(objects[5], firstToRemove);
|
||||||
|
|
||||||
timeSinceLastBottomHole = 0;
|
timeSinceLastBottomHole = 0;
|
||||||
|
noMiddleObstaclesForNext = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +133,13 @@ class PlatformHolder extends Holder {
|
|||||||
platform.row = level;
|
platform.row = level;
|
||||||
gameRef.add(platform.sprite);
|
gameRef.add(platform.sprite);
|
||||||
objects[level].add(platform);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,9 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
if (gameRef.gameState.isPaused) {
|
if (gameRef.gameState.isPaused) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
previousState = runnerState;
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case "jump":
|
case "jump":
|
||||||
|
previousState = runnerState;
|
||||||
runnerState = event;
|
runnerState = event;
|
||||||
sprite.current = RunnerState.jump;
|
sprite.current = RunnerState.jump;
|
||||||
sprite.addEffect(MoveEffect(
|
sprite.addEffect(MoveEffect(
|
||||||
@ -94,6 +94,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
if (belowPlatform()) {
|
if (belowPlatform()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
previousState = runnerState;
|
||||||
sprite.clearEffects();
|
sprite.clearEffects();
|
||||||
if (level - 1 < 0) {
|
if (level - 1 < 0) {
|
||||||
break;
|
break;
|
||||||
@ -117,20 +118,24 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case "fall":
|
case "fall":
|
||||||
|
previousState = runnerState;
|
||||||
sprite.clearEffects();
|
sprite.clearEffects();
|
||||||
runnerState = event;
|
runnerState = event;
|
||||||
sprite.current = RunnerState.fall;
|
sprite.current = RunnerState.fall;
|
||||||
sprite.addEffect(getFallingEffect());
|
sprite.addEffect(getFallingEffect());
|
||||||
break;
|
break;
|
||||||
case "kick":
|
case "kick":
|
||||||
|
previousState = runnerState;
|
||||||
runnerState = event;
|
runnerState = event;
|
||||||
sprite.current = RunnerState.kick;
|
sprite.current = RunnerState.kick;
|
||||||
break;
|
break;
|
||||||
case "run":
|
case "run":
|
||||||
|
previousState = runnerState;
|
||||||
runnerState = event;
|
runnerState = event;
|
||||||
sprite.current = RunnerState.run;
|
sprite.current = RunnerState.run;
|
||||||
break;
|
break;
|
||||||
case "float":
|
case "float":
|
||||||
|
previousState = runnerState;
|
||||||
runnerState = event;
|
runnerState = event;
|
||||||
sprite.current = RunnerState.float;
|
sprite.current = RunnerState.float;
|
||||||
sprite.addEffect(MoveEffect(
|
sprite.addEffect(MoveEffect(
|
||||||
@ -148,6 +153,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case "duck":
|
case "duck":
|
||||||
|
previousState = runnerState;
|
||||||
runnerState = event;
|
runnerState = event;
|
||||||
sprite.current = RunnerState.duck;
|
sprite.current = RunnerState.duck;
|
||||||
sprite.addEffect(MoveEffect(
|
sprite.addEffect(MoveEffect(
|
||||||
@ -163,6 +169,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
if (dead) {
|
if (dead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
previousState = runnerState;
|
||||||
sprite.clearEffects();
|
sprite.clearEffects();
|
||||||
level = 11;
|
level = 11;
|
||||||
sprite.addEffect(MoveEffect(
|
sprite.addEffect(MoveEffect(
|
||||||
@ -179,6 +186,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
if (dead) {
|
if (dead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
previousState = runnerState;
|
||||||
sprite.clearEffects();
|
sprite.clearEffects();
|
||||||
level = 11;
|
level = 11;
|
||||||
sprite.addEffect(MoveEffect(
|
sprite.addEffect(MoveEffect(
|
||||||
@ -195,6 +203,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
if (dead) {
|
if (dead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
previousState = runnerState;
|
||||||
sprite.clearEffects();
|
sprite.clearEffects();
|
||||||
level = 11;
|
level = 11;
|
||||||
sprite.addEffect(MoveEffect(
|
sprite.addEffect(MoveEffect(
|
||||||
@ -324,6 +333,14 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
sprite.current = RunnerState.run;
|
sprite.current = RunnerState.run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runnerState == "float" || runnerState == "double_jump") {
|
||||||
|
if (onTopOfPlatform()) {
|
||||||
|
updateLevel();
|
||||||
|
sprite.clearEffects();
|
||||||
|
event("run");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
intersecting();
|
intersecting();
|
||||||
sprite.update(dt);
|
sprite.update(dt);
|
||||||
}
|
}
|
||||||
@ -347,7 +364,11 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool belowPlatform() {
|
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;
|
bool belowPlatform = false;
|
||||||
for (List<MovingObject> platformLevel in gameRef.platformHolder.objects) {
|
for (List<MovingObject> platformLevel in gameRef.platformHolder.objects) {
|
||||||
for (MovingObject p in platformLevel) {
|
for (MovingObject p in platformLevel) {
|
||||||
|
@ -31,7 +31,7 @@ class Wall extends MovingObject {
|
|||||||
gameRef.blockSize *
|
gameRef.blockSize *
|
||||||
(gameRef.wallHolder.wall.width / gameRef.wallHolder.wall.height / 5) *
|
(gameRef.wallHolder.wall.width / gameRef.wallHolder.wall.height / 5) *
|
||||||
2.0,
|
2.0,
|
||||||
gameRef.blockSize * 0.5,
|
gameRef.blockSize * 0.35,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user