Fixed the platform issue #2 on Web, and made the beginning platforms more seamless. Added a new Kick animation and the ability to cancel a kick.

This commit is contained in:
Marco Salazar 2021-09-14 11:23:02 -06:00
parent c7469ec558
commit 135aa3efcc
4 changed files with 13 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -5,6 +5,7 @@ import 'package:firo_runner/circuit_background.dart';
import 'package:firo_runner/coin_holder.dart';
import 'package:firo_runner/firework.dart';
import 'package:firo_runner/game_state.dart';
import 'package:firo_runner/platform.dart';
import 'package:firo_runner/platform_holder.dart';
import 'package:firo_runner/wire.dart';
import 'package:firo_runner/wire_holder.dart';
@ -203,6 +204,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
runner.setUp();
fillScreen();
platformHolder.platforms[2][0].sprite.current = PlatformState.left;
platformHolder.platforms[5][0].sprite.current = PlatformState.left;
}
@override

View File

@ -99,7 +99,7 @@ class Platform extends MovingObject {
right = platformLevel.elementAt(index + 1).sprite.position;
}
super.update(dt);
if (index == -1 || sprite.position.x <= 0) {
if (index == -1 || (index < 1 && sprite.x <= sprite.width)) {
return;
}
Vector2 left = Vector2(-200, -200);

View File

@ -239,6 +239,13 @@ class Runner extends Component with HasGameRef<MyGame> {
event("kick");
}
break;
case "left":
if (runnerState == "kick") {
sprite.animation!.reset();
sprite.clearEffects();
event("run");
}
break;
case "center":
// if (runnerState == "fall") {
// updateLevel();
@ -367,8 +374,6 @@ class Runner extends Component with HasGameRef<MyGame> {
}
} else if (intersectState == "left" && runnerState == "kick") {
bugLevel[i].sprite.current = BugState.breaking;
// bugLevel[i].remove();
// bugLevel.removeAt(i);
} else {
event("glitch");
return;
@ -416,8 +421,8 @@ class Runner extends Component with HasGameRef<MyGame> {
SpriteAnimation kicking = await loadSpriteAnimation(
'kick-frames.png',
SpriteAnimationData.sequenced(
amount: 13,
stepTime: 0.05,
amount: 19,
stepTime: 0.03,
textureSize: Vector2(512, 512),
loop: false,
),