forked from marco/firo_runner
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:
parent
c7469ec558
commit
135aa3efcc
Binary file not shown.
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 1.4 MiB |
@ -5,6 +5,7 @@ import 'package:firo_runner/circuit_background.dart';
|
|||||||
import 'package:firo_runner/coin_holder.dart';
|
import 'package:firo_runner/coin_holder.dart';
|
||||||
import 'package:firo_runner/firework.dart';
|
import 'package:firo_runner/firework.dart';
|
||||||
import 'package:firo_runner/game_state.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/platform_holder.dart';
|
||||||
import 'package:firo_runner/wire.dart';
|
import 'package:firo_runner/wire.dart';
|
||||||
import 'package:firo_runner/wire_holder.dart';
|
import 'package:firo_runner/wire_holder.dart';
|
||||||
@ -203,6 +204,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
|
|||||||
runner.setUp();
|
runner.setUp();
|
||||||
|
|
||||||
fillScreen();
|
fillScreen();
|
||||||
|
platformHolder.platforms[2][0].sprite.current = PlatformState.left;
|
||||||
|
platformHolder.platforms[5][0].sprite.current = PlatformState.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -99,7 +99,7 @@ class Platform extends MovingObject {
|
|||||||
right = platformLevel.elementAt(index + 1).sprite.position;
|
right = platformLevel.elementAt(index + 1).sprite.position;
|
||||||
}
|
}
|
||||||
super.update(dt);
|
super.update(dt);
|
||||||
if (index == -1 || sprite.position.x <= 0) {
|
if (index == -1 || (index < 1 && sprite.x <= sprite.width)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector2 left = Vector2(-200, -200);
|
Vector2 left = Vector2(-200, -200);
|
||||||
|
@ -239,6 +239,13 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
event("kick");
|
event("kick");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "left":
|
||||||
|
if (runnerState == "kick") {
|
||||||
|
sprite.animation!.reset();
|
||||||
|
sprite.clearEffects();
|
||||||
|
event("run");
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "center":
|
case "center":
|
||||||
// if (runnerState == "fall") {
|
// if (runnerState == "fall") {
|
||||||
// updateLevel();
|
// updateLevel();
|
||||||
@ -367,8 +374,6 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
}
|
}
|
||||||
} else if (intersectState == "left" && runnerState == "kick") {
|
} else if (intersectState == "left" && runnerState == "kick") {
|
||||||
bugLevel[i].sprite.current = BugState.breaking;
|
bugLevel[i].sprite.current = BugState.breaking;
|
||||||
// bugLevel[i].remove();
|
|
||||||
// bugLevel.removeAt(i);
|
|
||||||
} else {
|
} else {
|
||||||
event("glitch");
|
event("glitch");
|
||||||
return;
|
return;
|
||||||
@ -416,8 +421,8 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
SpriteAnimation kicking = await loadSpriteAnimation(
|
SpriteAnimation kicking = await loadSpriteAnimation(
|
||||||
'kick-frames.png',
|
'kick-frames.png',
|
||||||
SpriteAnimationData.sequenced(
|
SpriteAnimationData.sequenced(
|
||||||
amount: 13,
|
amount: 19,
|
||||||
stepTime: 0.05,
|
stepTime: 0.03,
|
||||||
textureSize: Vector2(512, 512),
|
textureSize: Vector2(512, 512),
|
||||||
loop: false,
|
loop: false,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user