Skip to content

Commit

Permalink
Fix bleeding pixels problem
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 10, 2023
1 parent cbada86 commit 4711add
Show file tree
Hide file tree
Showing 16 changed files with 1,443 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
# Session related
*.png~
*.tiled-session
/node_modules
Binary file modified app/assets/images/ground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/wall.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: 2 additions & 2 deletions app/assets/tiles/ground.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="ground" tilewidth="16" tileheight="16" tilecount="64" columns="8">
<image source="../images/ground.png" width="128" height="128"/>
<tileset version="1.10" tiledversion="1.10.2" name="ground" tilewidth="16" tileheight="16" spacing="2" margin="1" tilecount="64" columns="8">
<image source="../images/ground.png" width="144" height="144"/>
</tileset>
4 changes: 2 additions & 2 deletions app/assets/tiles/wall.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="wall" tilewidth="16" tileheight="16" tilecount="64" columns="8">
<image source="../images/wall.png" width="128" height="128"/>
<tileset version="1.10" tiledversion="1.10.2" name="wall" tilewidth="16" tileheight="16" spacing="2" margin="1" tilecount="64" columns="8">
<image source="../images/wall.png" width="144" height="144"/>
</tileset>
Binary file added app/images/ground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/wall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { extrudeTilesetToImage } from "tile-extruder";

const files = [
"ground.png",
"player.png",
"wall.png"
];

async function main() {
for (const file of files) {
await extrudeTilesetToImage(16, 16, `images/${file}`, `assets/images/${file}`);
}
}

main();
16 changes: 9 additions & 7 deletions app/lib/game/player.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import 'dart:async';
import 'dart:math';
import 'dart:ui' as ui;

import 'package:flame/collisions.dart';
import 'package:flame/components.dart';
import 'package:flame/effects.dart';
import 'package:flame/flame.dart';
import 'package:flame/text.dart';
import 'package:flame_tiled/flame_tiled.dart';
import 'package:qeck/game/board.dart';
import 'package:qeck/game/wall.dart';

enum PlayerState { idle, walking, jumping }
import 'package:qeck/services/network.dart';

class _PreviousPlayerPositionComponent extends ReadOnlyPositionProvider {
final BoardPlayer player;
Expand Down Expand Up @@ -58,21 +55,26 @@ class BoardPlayer extends SpriteAnimationGroupComponent<PlayerState>
);

add(_text);
add(RectangleHitbox(size: size));
final realSize = Vector2.all(12);
add(RectangleHitbox(
size: realSize,
));
}

SpriteAnimation _getAnimation({
required List<Vector2> frames,
double stepTime = double.infinity,
}) {
final size = Vector2.all(16);
final size = Vector2.all(18);
return SpriteAnimation.spriteList(
frames
.map(
(vector) => Sprite(
_image,
srcSize: size,
srcPosition: vector.clone()..multiply(size),
srcPosition: vector.clone()
..multiply(size)
..add(Vector2.all(1)),
),
)
.toList(),
Expand Down
4 changes: 4 additions & 0 deletions app/lib/services/network.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ enum NetworkingType {
};
}

enum PlayerState { idle, walking, jumping }

@MappableClass()
class NetworkingUser with NetworkingUserMappable {
final String name;
final PlayerState state;
final (double, double) position;
final (double, double) velocity;

const NetworkingUser({
required this.name,
required this.position,
this.state = PlayerState.idle,
this.velocity = const (0, 0),
});
}
Expand Down
17 changes: 17 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "qeck-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"tile-extruder": "^2.1.0"
}
}
Loading

1 comment on commit 4711add

@vercel
Copy link

@vercel vercel bot commented on 4711add Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

qeck – ./app

qeck-git-develop-linwood.vercel.app
qeck.linwood.dev
qeck-linwood.vercel.app
qeck.vercel.app

Please sign in to comment.