Added Menu music, increased difficulty, and added last animation.

This commit is contained in:
Marco Salazar 2021-10-03 13:11:40 -06:00
parent 91e5554105
commit 9835024376
30 changed files with 47 additions and 29 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -27,7 +27,7 @@ class BugHolder extends Holder {
bool generateBug(MyGame gameRef, int level, bool generateBug(MyGame gameRef, int level,
{bool force = false, double xPosition = 0}) { {bool force = false, double xPosition = 0}) {
if (objects[level].isNotEmpty) { if (objects[level].length > 2) {
return false; return false;
} }

View File

@ -20,7 +20,7 @@ class DebrisHolder extends Holder {
bool generateDebris(MyGame gameRef, int level, bool generateDebris(MyGame gameRef, int level,
{bool force = false, double xPosition = 0}) { {bool force = false, double xPosition = 0}) {
if (objects[level].isNotEmpty) { if (objects[level].length > 1) {
return false; return false;
} }

View File

@ -120,19 +120,19 @@ class GameState extends Component {
if (!isPaused) { if (!isPaused) {
switch (getLevel()) { switch (getLevel()) {
case 7: case 7:
return gameRef.viewport.canvasSize.x * 0.28; return gameRef.viewport.canvasSize.x * 0.30;
case 6: case 6:
return gameRef.viewport.canvasSize.x * 0.26; return gameRef.viewport.canvasSize.x * 0.28;
case 5: case 5:
return gameRef.viewport.canvasSize.x * 0.24; return gameRef.viewport.canvasSize.x * 0.26;
case 4: case 4:
return gameRef.viewport.canvasSize.x * 0.22; return gameRef.viewport.canvasSize.x * 0.24;
case 3: case 3:
return gameRef.viewport.canvasSize.x * 0.20; return gameRef.viewport.canvasSize.x * 0.22;
case 2: case 2:
return gameRef.viewport.canvasSize.x * 0.18; return gameRef.viewport.canvasSize.x * 0.20;
default: default:
return gameRef.viewport.canvasSize.x * 0.16; return gameRef.viewport.canvasSize.x * 0.18;
} }
} else { } else {
return 0; return 0;

View File

@ -191,7 +191,11 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
} }
void playMusic() { void playMusic() {
FlameAudio.bgm.play('Infinite_Spankage_M.mp3'); if (overlays.isActive('mainMenu')) {
FlameAudio.bgm.play('Infinite_Menu.mp3');
} else {
FlameAudio.bgm.play('Infinite_Spankage_M.mp3');
}
playingMusic = true; playingMusic = true;
} }
@ -355,6 +359,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
void mainMenu() { void mainMenu() {
overlays.remove('gameOver'); overlays.remove('gameOver');
overlays.add('mainMenu'); overlays.add('mainMenu');
FlameAudio.bgm.stop();
FlameAudio.bgm.play('Infinite_Menu.mp3');
} }
void reset() { void reset() {
@ -535,33 +541,41 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
} }
print(event.data.logicalKey.keyId); print(event.data.logicalKey.keyId);
print(event.data.keyLabel); print(event.data.keyLabel);
if (event is RawKeyUpEvent) { if (event is RawKeyDownEvent) {
action = true;
keyboardKey = null; keyboardKey = null;
switch (event.data.keyLabel) { switch (event.data.logicalKey.keyId) {
case "w": case 4294968068:
case 119:
case 87:
// case "w":
runner.control("up"); runner.control("up");
break; break;
case "a": case 4294968066:
case 97:
case 65:
// case "a":
runner.control("left"); runner.control("left");
break; break;
case "s": case 4294968065:
case 115:
case 83:
// case "s":
runner.control("down"); runner.control("down");
break; break;
case "d": case 4294968067:
case 100:
case 68:
// case "d":
runner.control("right"); runner.control("right");
break; break;
default: default:
if (event.data.logicalKey.keyId == 32) {
runner.control("down");
}
break; break;
} }
} }
if (event is RawKeyDownEvent && event.data.logicalKey.keyId == 32) {
if (keyboardKey == null) { if (event is RawKeyUpEvent) {
runner.control("center"); action = false;
}
keyboardKey = "spacebar";
} }
} }
} }

View File

@ -1,3 +1,4 @@
import 'package:flame_audio/flame_audio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'main.dart'; import 'main.dart';
@ -66,6 +67,8 @@ class MainMenuOverlay extends StatelessWidget {
onPressed: () { onPressed: () {
// Go to the Main Menu // Go to the Main Menu
game.reset(); game.reset();
FlameAudio.bgm.stop();
FlameAudio.bgm.play('Infinite_Spankage_M.mp3');
}, },
), ),
// MaterialButton( // MaterialButton(

View File

@ -697,12 +697,12 @@ class Runner extends Component with HasGameRef<MyGame> {
SpriteAnimation.spriteList(floats3, stepTime: 0.02, loop: true); SpriteAnimation.spriteList(floats3, stepTime: 0.02, loop: true);
List<Sprite> falls = []; List<Sprite> falls = [];
for (int i = 1; i <= 38; i++) { for (int i = 1; i <= 20; i++) {
final composition = ImageComposition() final composition = ImageComposition()
..add(satellites.elementAt(i - 1), Vector2(0, 0)) ..add(satellites.elementAt(((i - 1) % 20)), Vector2(0, 0))
..add( ..add(
await Flame.images.load( await Flame.images.load(
'runner/run/run00${i < 10 ? "0" + i.toString() : i.toString()}.png'), 'runner/fall/fall00${i < 10 ? "0" + i.toString() : i.toString()}.png'),
Vector2(0, 0)); Vector2(0, 0));
falls.add(Sprite(await composition.compose())); falls.add(Sprite(await composition.compose()));

View File

@ -20,7 +20,7 @@ class WallHolder extends Holder {
bool generateWall(MyGame gameRef, int level, bool generateWall(MyGame gameRef, int level,
{bool force = false, double xPosition = 0}) { {bool force = false, double xPosition = 0}) {
if (objects[level].isNotEmpty) { if (objects[level].length > 1) {
return false; return false;
} }

View File

@ -20,7 +20,7 @@ class WireHolder extends Holder {
bool generateWire(MyGame gameRef, int level, bool generateWire(MyGame gameRef, int level,
{bool force = false, double xPosition = 0}) { {bool force = false, double xPosition = 0}) {
if (objects[level].isNotEmpty) { if (objects[level].length > 1) {
return false; return false;
} }

View File

@ -59,6 +59,7 @@ flutter:
- assets/audio/ - assets/audio/
- assets/audio/sfx/ - assets/audio/sfx/
- assets/images/runner/run/ - assets/images/runner/run/
- assets/images/runner/fall/
- assets/images/runner/satellite/ - assets/images/runner/satellite/
- assets/images/runner/death/ - assets/images/runner/death/
- assets/images/runner/deathglitch/ - assets/images/runner/deathglitch/