staging #20
29
analysis_options.yaml
Normal file
29
analysis_options.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at
|
||||
# https://dart-lang.github.io/linter/lints/index.html.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
@ -1,4 +1,4 @@
|
||||
import 'package:firo_runner/MovingObject.dart';
|
||||
import 'package:firo_runner/moving_object.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/components.dart';
|
||||
|
@ -1,14 +1,15 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:firo_runner/Platform.dart';
|
||||
import 'package:firo_runner/platform.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
|
||||
import 'Bug.dart';
|
||||
import 'main.dart';
|
||||
import 'package:firo_runner/bug.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
|
||||
class BugHolder {
|
||||
var bug;
|
||||
var breaking;
|
||||
late Image bug;
|
||||
late Image breaking;
|
||||
Random random = Random();
|
||||
|
||||
late List<List<Bug>> bugs = [];
|
@ -1,8 +1,8 @@
|
||||
import 'package:firo_runner/MovingObject.dart';
|
||||
import 'package:firo_runner/moving_object.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/components.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
|
||||
enum WindowState {
|
||||
first,
|
||||
@ -15,14 +15,14 @@ enum WindowState {
|
||||
}
|
||||
|
||||
class CircuitBackground extends MovingObject {
|
||||
late var background;
|
||||
late var windows0;
|
||||
late var windows1;
|
||||
late var windows2;
|
||||
late var windows3;
|
||||
late var windows4;
|
||||
late var windows5;
|
||||
late var windows6;
|
||||
late Image background;
|
||||
late Image windows0;
|
||||
late Image windows1;
|
||||
late Image windows2;
|
||||
late Image windows3;
|
||||
late Image windows4;
|
||||
late Image windows5;
|
||||
late Image windows6;
|
||||
|
||||
late Sprite background1;
|
||||
late Sprite background2;
|
||||
@ -140,7 +140,7 @@ class CircuitBackground extends MovingObject {
|
||||
gameRef.add(windowB);
|
||||
background1Position = Vector2(0, 0);
|
||||
background1Size = Vector2(
|
||||
gameRef.size.y * (background!.width / background!.height),
|
||||
gameRef.size.y * (background.width / background.height),
|
||||
gameRef.size.y);
|
||||
windowA.position = background1Position;
|
||||
windowA.size = background1Size;
|
||||
@ -148,7 +148,7 @@ class CircuitBackground extends MovingObject {
|
||||
background2Position =
|
||||
Vector2(background1Position.x + background1Size.x - 1, 0);
|
||||
background2Size = Vector2(
|
||||
gameRef.size.y * (background!.width / background!.height),
|
||||
gameRef.size.y * (background.width / background.height),
|
||||
gameRef.size.y);
|
||||
windowB.position = background2Position;
|
||||
windowB.size = background2Size;
|
@ -1,4 +1,4 @@
|
||||
import 'package:firo_runner/MovingObject.dart';
|
||||
import 'package:firo_runner/moving_object.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/components.dart';
|
||||
|
||||
@ -28,8 +28,8 @@ class Coin extends MovingObject {
|
||||
var platform = gameRef.platformHolder.l1;
|
||||
|
||||
setSize(
|
||||
gameRef.blockSize * (platform!.width / platform!.height / 14),
|
||||
gameRef.blockSize * (platform!.width / platform!.height / 14),
|
||||
gameRef.blockSize * (platform.width / platform.height / 14),
|
||||
gameRef.blockSize * (platform.width / platform.height / 14),
|
||||
);
|
||||
}
|
||||
|
@ -2,11 +2,12 @@ import 'dart:math';
|
||||
|
||||
import 'package:flame/flame.dart';
|
||||
|
||||
import 'Coin.dart';
|
||||
import 'main.dart';
|
||||
import 'package:firo_runner/coin.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
|
||||
class CoinHolder {
|
||||
var coin;
|
||||
late Image coin;
|
||||
Random random = Random();
|
||||
|
||||
late List<List<Coin>> coins = [];
|
@ -1,12 +1,12 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:firo_runner/BugHolder.dart';
|
||||
import 'package:firo_runner/CircuitBackground.dart';
|
||||
import 'package:firo_runner/CoinHolder.dart';
|
||||
import 'package:firo_runner/GameState.dart';
|
||||
import 'package:firo_runner/PlatformHolder.dart';
|
||||
import 'package:firo_runner/Wire.dart';
|
||||
import 'package:firo_runner/WireHolder.dart';
|
||||
import 'package:firo_runner/bug_holder.dart';
|
||||
import 'package:firo_runner/circuit_background.dart';
|
||||
import 'package:firo_runner/coin_holder.dart';
|
||||
import 'package:firo_runner/game_state.dart';
|
||||
import 'package:firo_runner/platform_holder.dart';
|
||||
import 'package:firo_runner/wire.dart';
|
||||
import 'package:firo_runner/wire_holder.dart';
|
||||
import 'package:flame/components.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
@ -16,12 +16,12 @@ import 'package:flame/keyboard.dart';
|
||||
import 'package:flame_audio/flame_audio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'Bug.dart';
|
||||
import 'Coin.dart';
|
||||
import 'Runner.dart';
|
||||
import 'package:firo_runner/bug.dart';
|
||||
import 'package:firo_runner/coin.dart';
|
||||
import 'package:firo_runner/runner.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
const COLOR = const Color(0xFFDDC0A3);
|
||||
const COLOR = Color(0xFFDDC0A3);
|
||||
|
||||
const LEVEL2 = 10000000;
|
||||
const LEVEL3 = 20000000;
|
||||
@ -46,7 +46,7 @@ void main() async {
|
||||
|
||||
class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
|
||||
TextPaint textPaint = TextPaint(
|
||||
config: TextPaintConfig(fontSize: 48.0),
|
||||
config: const TextPaintConfig(fontSize: 48.0),
|
||||
);
|
||||
|
||||
late CircuitBackground circuitBackground;
|
||||
@ -161,7 +161,7 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
|
||||
}
|
||||
runner.sprite.animation!.reset();
|
||||
shouldReset = false;
|
||||
this.components.clear();
|
||||
components.clear();
|
||||
setUp();
|
||||
}
|
||||
|
||||
@ -218,15 +218,14 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
|
||||
wireHolder.update(dt);
|
||||
bugHolder.update(dt);
|
||||
if (shouldReset) {
|
||||
print("should reset");
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onResize(Vector2 size) {
|
||||
super.onResize(size);
|
||||
blockSize = size.y / 9;
|
||||
void onResize(Vector2 canvasSize) {
|
||||
super.onResize(canvasSize);
|
||||
blockSize = canvasSize.y / 9;
|
||||
}
|
||||
|
||||
// Mobile controls
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:firo_runner/MovingObject.dart';
|
||||
import 'package:firo_runner/moving_object.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/components.dart';
|
||||
|
||||
@ -70,8 +70,8 @@ class Platform extends MovingObject {
|
||||
|
||||
setSize(
|
||||
gameRef.blockSize *
|
||||
(gameRef.platformHolder.l1!.width /
|
||||
gameRef.platformHolder.l1!.height /
|
||||
(gameRef.platformHolder.l1.width /
|
||||
gameRef.platformHolder.l1.height /
|
||||
5),
|
||||
gameRef.blockSize,
|
||||
);
|
@ -2,17 +2,18 @@ import 'dart:math';
|
||||
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
import 'Platform.dart';
|
||||
import 'package:firo_runner/platform.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
|
||||
class PlatformHolder {
|
||||
var l1;
|
||||
var l2;
|
||||
var m1;
|
||||
var m2;
|
||||
var r1;
|
||||
var r2;
|
||||
var o1;
|
||||
var o2;
|
||||
late Image l1;
|
||||
late Image l2;
|
||||
late Image m1;
|
||||
late Image m2;
|
||||
late Image r1;
|
||||
late Image r2;
|
||||
late Image o1;
|
||||
late Image o2;
|
||||
late List<List<Platform>> platforms = [];
|
||||
Random random = Random();
|
||||
|
@ -1,10 +1,11 @@
|
||||
import 'package:firo_runner/Bug.dart';
|
||||
import 'package:firo_runner/Coin.dart';
|
||||
import 'package:firo_runner/Wire.dart';
|
||||
import 'package:firo_runner/bug.dart';
|
||||
import 'package:firo_runner/coin.dart';
|
||||
import 'package:firo_runner/wire.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/effects.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'Platform.dart';
|
||||
import 'package:firo_runner/platform.dart';
|
||||
|
||||
import 'package:flame/components.dart';
|
||||
|
||||
@ -16,7 +17,7 @@ enum RunnerState {
|
||||
float,
|
||||
fall,
|
||||
die,
|
||||
electro,
|
||||
electrocute,
|
||||
glitch,
|
||||
}
|
||||
|
||||
@ -26,7 +27,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
int level = 4;
|
||||
String previousState = "run";
|
||||
var runnerPosition = Vector2(0, 0);
|
||||
var runnerSize;
|
||||
late Vector2 runnerSize;
|
||||
bool dead = false;
|
||||
|
||||
void setUp() {
|
||||
@ -72,7 +73,6 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
return;
|
||||
}
|
||||
previousState = runnerState;
|
||||
print(event);
|
||||
switch (event) {
|
||||
case "jump":
|
||||
runnerState = event;
|
||||
@ -90,7 +90,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
},
|
||||
));
|
||||
break;
|
||||
case "doublejump":
|
||||
case "double_jump":
|
||||
if (level - 1 < 0) {
|
||||
break;
|
||||
}
|
||||
@ -157,12 +157,12 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
sprite.current = RunnerState.die;
|
||||
gameRef.die();
|
||||
break;
|
||||
case "electro":
|
||||
case "electrocute":
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
runnerState = event;
|
||||
sprite.current = RunnerState.electro;
|
||||
sprite.current = RunnerState.electrocute;
|
||||
gameRef.die();
|
||||
break;
|
||||
case "glitch":
|
||||
@ -182,13 +182,12 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (gameRef.gameState.isPaused) {
|
||||
return;
|
||||
}
|
||||
print(input);
|
||||
switch (input) {
|
||||
case "up":
|
||||
if (runnerState == "run") {
|
||||
event("jump");
|
||||
} else if (runnerState == "float" && previousState == "jump") {
|
||||
event("doublejump");
|
||||
event("double_jump");
|
||||
} else if (runnerState == "duck") {
|
||||
event("run");
|
||||
}
|
||||
@ -277,7 +276,6 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
if (coinLevel[i].intersect(runnerRect) != "none") {
|
||||
gameRef.gameState.numCoins++;
|
||||
gameRef.coinHolder.remove(coinLevel, i);
|
||||
print(gameRef.gameState.numCoins);
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
@ -287,7 +285,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
for (List<Wire> wireLevel in gameRef.wireHolder.wires) {
|
||||
for (int i = 0; i < wireLevel.length; i++) {
|
||||
if (wireLevel[i].intersect(runnerRect) != "none") {
|
||||
event("electro");
|
||||
event("electrocute");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -425,7 +423,7 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
RunnerState.float: floating,
|
||||
RunnerState.fall: falling,
|
||||
RunnerState.die: dying,
|
||||
RunnerState.electro: dyingElectrocuted,
|
||||
RunnerState.electrocute: dyingElectrocuted,
|
||||
RunnerState.glitch: dyingGlitch,
|
||||
},
|
||||
current: RunnerState.run,
|
@ -1,4 +1,4 @@
|
||||
import 'package:firo_runner/MovingObject.dart';
|
||||
import 'package:firo_runner/moving_object.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/components.dart';
|
||||
|
@ -1,13 +1,14 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:firo_runner/Platform.dart';
|
||||
import 'package:firo_runner/platform.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
|
||||
import 'Wire.dart';
|
||||
import 'main.dart';
|
||||
import 'package:firo_runner/wire.dart';
|
||||
import 'package:firo_runner/main.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
|
||||
class WireHolder {
|
||||
var wire;
|
||||
late Image wire;
|
||||
Random random = Random();
|
||||
|
||||
late List<List<Wire>> wires = [];
|
@ -2,6 +2,8 @@
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
|
24
pubspec.lock
24
pubspec.lock
@ -7,7 +7,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
version: "2.8.1"
|
||||
audioplayers:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -35,7 +35,7 @@ packages:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.1"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -104,6 +104,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -135,6 +142,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -148,7 +162,7 @@ packages:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.7.0"
|
||||
ordered_set:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -279,7 +293,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
version: "0.4.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -307,7 +321,7 @@ packages:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.8"
|
||||
version: "2.2.9"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -32,6 +32,7 @@ dependencies:
|
||||
cupertino_icons: ^1.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^1.0.4
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user