fix verifyExistiInWorld
MODIFY
lib/map/map_game.dart
lib/map/map_game.dart
+import 'dart:ui';
import 'package:bonfire/map/tile.dart';
import 'package:bonfire/rpg_game.dart';
import 'package:flame/components/component.dart';
@@ -14,4 +15,6 @@ abstract class MapGame extends Component with HasGameRef<RPGGame> {
Iterable<Tile> getCollisions();
void updateTiles(Iterable<Tile> map);
+
+ Size getMapSize();
}

MODIFY
lib/map/map_world.dart
lib/map/map_world.dart
@@ -97,4 +97,17 @@ class MapWorld extends MapGame {
this.tiles = map;
verifyMaxTopAndLeft(gameRef.size);
}
+
+ @override
+ Size getMapSize() {
+ double height = 0;
+ double width = 0;
+
+ this.tiles.forEach((tile) {
+ if (tile.position.right > width) width = tile.position.right;
+ if (tile.position.bottom > height) height = tile.position.bottom;
+ });
+
+ return Size(width, height);
+ }
}

MODIFY
lib/util/objects/flying_attack_angle_object.dart
lib/util/objects/flying_attack_angle_object.dart
@@ -149,21 +149,19 @@ class FlyingAttackAngleObject extends AnimatedObject
}
bool _verifyExistInWorld() {
- // TODO: Update this logic
+ final mapSize = gameRef.map.getMapSize();
bool result = true;
if (position.left < 0) {
result = false;
}
- if (position.right >
- gameRef.gameCamera.maxLeft + gameRef.size.width) {
+ if (position.right > mapSize.width) {
result = false;
}
if (position.top < 0) {
result = false;
}
- if (position.bottom >
- gameRef.gameCamera.maxTop + gameRef.size.height) {
+ if (position.bottom > mapSize.height) {
result = false;
}

fix verifyExistiInWorld