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 force = false, double xPosition = 0}) {
if (objects[level].isNotEmpty) {
if (objects[level].length > 2) {
return false;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -697,12 +697,12 @@ class Runner extends Component with HasGameRef<MyGame> {
SpriteAnimation.spriteList(floats3, stepTime: 0.02, loop: true);
List<Sprite> falls = [];
for (int i = 1; i <= 38; i++) {
for (int i = 1; i <= 20; i++) {
final composition = ImageComposition()
..add(satellites.elementAt(i - 1), Vector2(0, 0))
..add(satellites.elementAt(((i - 1) % 20)), Vector2(0, 0))
..add(
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));
falls.add(Sprite(await composition.compose()));

View File

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

View File

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

View File

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