Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

feat: removing enemies #9

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed assets/images/flying_character.png
Binary file not shown.
Binary file removed assets/images/running_character.png
Binary file not shown.
Binary file removed assets/images/tile_clouds_v01.png
Binary file not shown.
Binary file removed assets/images/tile_enemies_v1.png
Binary file not shown.
Binary file removed assets/images/tile_forest_ground_v01.png
Binary file not shown.
Binary file removed assets/images/tile_forest_trees_v01.png
Binary file not shown.
Binary file removed assets/images/tile_gate_v1.png
Binary file not shown.
Binary file removed assets/images/tile_ground_transition_v01.png
Binary file not shown.
Binary file removed assets/images/tile_items_v1.png
Binary file not shown.
Binary file removed assets/images/tile_mountain_ground_v01.png
Binary file not shown.
Binary file removed assets/images/tile_plains_ground_v01.png
Binary file not shown.
2 changes: 2 additions & 0 deletions assets/map/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.tiled-project
*.tiled-session
837 changes: 837 additions & 0 deletions assets/map/flutter_runnergame_map_v04.tmx

Large diffs are not rendered by default.

Binary file added assets/map/objects/tile_enemies_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/objects/tile_enemies_v2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_enemies_v2" tilewidth="64" tileheight="64" tilecount="6" columns="2">
<image source="tile_enemies_v2.png" width="128" height="192"/>
</tileset>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/objects/tile_forest_trees_back_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_forest_trees_back_v02" tilewidth="448" tileheight="704" tilecount="3" columns="3">
<image source="tile_forest_trees_back_v02.png" width="1344" height="704"/>
</tileset>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/objects/tile_forest_trees_front_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_forest_trees_front_v02" tilewidth="192" tileheight="320" tilecount="3" columns="3">
<image source="tile_forest_trees_front_v02.png" width="576" height="320"/>
</tileset>
Binary file added assets/map/objects/tile_items_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/objects/tile_items_v2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_items_v2" tilewidth="64" tileheight="64" tilecount="4" columns="2">
<image source="tile_items_v2.png" width="128" height="128"/>
</tileset>
Binary file added assets/map/objects/tile_mountain_tree_v01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/objects/tile_mountain_tree_v01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_mountain_tree_v01" tilewidth="256" tileheight="320" tilecount="2" columns="2">
<image source="tile_mountain_tree_v01.png" width="512" height="320"/>
</tileset>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/objects/tile_plains_mountains_v01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_plains_mountains_v01" tilewidth="576" tileheight="384" tilecount="2" columns="2">
<image source="tile_plains_mountains_v01.png" width="1152" height="384"/>
</tileset>
Binary file added assets/map/tiles/tile_clouds_v02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_clouds_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_clouds_v02" tilewidth="64" tileheight="64" tilecount="72" columns="8">
<image source="tile_clouds_v02.png" width="512" height="576"/>
</tileset>
Binary file added assets/map/tiles/tile_decorations_v01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_decorations_v01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_decorations_v01" tilewidth="64" tileheight="64" tilecount="27" columns="9">
<image source="tile_decorations_v01.png" width="576" height="192"/>
</tileset>
Binary file added assets/map/tiles/tile_forest_bushes_v02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_forest_bushes_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_forest_bushes_v02" tilewidth="64" tileheight="64" tilecount="60" columns="12">
<image source="tile_forest_bushes_v02.png" width="768" height="320"/>
</tileset>
Binary file added assets/map/tiles/tile_forest_ground_v02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_forest_ground_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_forest_ground_v02" tilewidth="64" tileheight="64" tilecount="30" columns="6">
<image source="tile_forest_ground_v02.png" width="384" height="320"/>
</tileset>
Binary file added assets/map/tiles/tile_gate_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_gate_v2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_gate_v2" tilewidth="64" tileheight="64" tilecount="20" columns="5">
<image source="tile_gate_v2.png" width="320" height="256"/>
</tileset>
Binary file added assets/map/tiles/tile_ground_transition_v02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_ground_transition_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_ground_transition_v02" tilewidth="64" tileheight="64" tilecount="20" columns="10">
<image source="tile_ground_transition_v02.png" width="640" height="128"/>
</tileset>
Binary file added assets/map/tiles/tile_mountain_ground_v02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_mountain_ground_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_mountain_ground_v02" tilewidth="64" tileheight="64" tilecount="55" columns="11">
<image source="tile_mountain_ground_v02.png" width="704" height="320"/>
</tileset>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_mountain_mountains_v01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_mountain_mountains_v01" tilewidth="64" tileheight="64" tilecount="33" columns="11">
<image source="tile_mountain_mountains_v01.png" width="704" height="192"/>
</tileset>
Binary file added assets/map/tiles/tile_mountain_stars_v01.png
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_mountain_stars_v01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_mountain_stars_v01" tilewidth="64" tileheight="64" tilecount="8" columns="4">
<image source="tile_mountain_stars_v01.png" width="256" height="128"/>
</tileset>
Binary file added assets/map/tiles/tile_plains_ground_v02.png
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_plains_ground_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_plains_ground_v02" tilewidth="64" tileheight="64" tilecount="30" columns="6">
<image source="tile_plains_ground_v02.png" width="384" height="320"/>
</tileset>
Binary file added assets/map/tiles/tile_plains_hills_v01.png
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_plains_hills_v01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_plains_hills_v01" tilewidth="64" tileheight="64" tilecount="78" columns="13">
<image source="tile_plains_hills_v01.png" width="832" height="384"/>
</tileset>
Binary file added assets/map/tiles/tile_sky_v02.png
4 changes: 4 additions & 0 deletions assets/map/tiles/tile_sky_v02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="tile_sky_v02" tilewidth="64" tileheight="64" tilecount="440" columns="22">
<image source="tile_sky_v02.png" width="1408" height="1280"/>
</tileset>
264 changes: 0 additions & 264 deletions assets/tiles/flutter_runnergame_map_v02.tmx

This file was deleted.

4 changes: 0 additions & 4 deletions assets/tiles/tile_clouds_v01.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions assets/tiles/tile_enemies_v1.tsx

This file was deleted.

122 changes: 0 additions & 122 deletions assets/tiles/tile_forest_ground_v01.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions assets/tiles/tile_forest_trees_v01.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions assets/tiles/tile_gate_v1.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions assets/tiles/tile_ground_transition_v01.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions assets/tiles/tile_items_v1.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions assets/tiles/tile_mountain_ground_v01.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions assets/tiles/tile_plains_ground_v01.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions lib/game/components/enemies.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:dash_run/game/dash_run_game.dart';
import 'package:dash_run/gen/assets.gen.dart';

import 'package:flame/components.dart';
import 'package:flame/sprite.dart';
Expand All @@ -11,7 +10,7 @@ class Enemies extends Component with HasGameRef<DashRunGame> {
Future<void> onLoad() async {
final enemiesLayer = gameRef.leapMap.getTileLayer<ObjectGroup>('enemies');
final enemyTiles = await gameRef.images.load(
Assets.images.tileEnemiesV1.path,
'objects/tile_enemies_v2.png',
);

for (final object in enemiesLayer.objects) {
Expand Down
3 changes: 1 addition & 2 deletions lib/game/components/items.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:async';

import 'package:dash_run/game/dash_run_game.dart';
import 'package:dash_run/gen/assets.gen.dart';
import 'package:flame/components.dart';
import 'package:flame/sprite.dart';
import 'package:flame_tiled/flame_tiled.dart';
Expand All @@ -12,7 +11,7 @@ class Items extends Component with HasGameRef<DashRunGame> {
Future<void> onLoad() async {
final itemsLayer = gameRef.leapMap.getTileLayer<ObjectGroup>('items');
final itemTiles = await gameRef.images.load(
Assets.images.tileItemsV1.path,
'objects/tile_items_v2.png',
);

for (final object in itemsLayer.objects) {
Expand Down
30 changes: 5 additions & 25 deletions lib/game/components/player.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'dart:async';

import 'package:dash_run/game/game.dart';
import 'package:dash_run/gen/assets.gen.dart';
import 'package:flame/cache.dart';

import 'package:flame/collisions.dart';
import 'package:flame/components.dart';
import 'package:flame_behaviors/flame_behaviors.dart';
import 'package:flutter/material.dart';

class Player extends PositionedEntity with HasGameRef<DashRunGame> {
Player()
Expand All @@ -27,7 +26,6 @@ class Player extends PositionedEntity with HasGameRef<DashRunGame> {
);

static final _size = Vector2.all(100);
static final _images = Images(prefix: '');

late final SpriteComponent flyingSprite;
late final SpriteAnimationComponent runningAnimation;
Expand All @@ -50,31 +48,13 @@ class Player extends PositionedEntity with HasGameRef<DashRunGame> {
),
);

final flyingSpriteImage = await Sprite.load(
Assets.images.flyingCharacter.path,
images: _images,
);
flyingSprite = SpriteComponent(
sprite: flyingSpriteImage,
size: size,
);

final animation = await SpriteAnimation.load(
Assets.images.runningCharacter.path,
SpriteAnimationData.sequenced(
amount: 2,
stepTime: .2,
textureSize: Vector2.all(32),
add(
RectangleComponent(
size: size,
paint: Paint()..color = Colors.blue,
),
images: _images,
);
runningAnimation = SpriteAnimationComponent(
animation: animation,
size: size,
);

add(runningAnimation);

position = Vector2(
200,
gameRef.resolution.y - DashRunGame.floorSize,
Expand Down
Loading