Skip to content

Commit

Permalink
Add linewidth 1 + no sub pixel rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
pomle authored and bouveng committed Jun 19, 2020
1 parent d4f20c4 commit 91faafb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions public/js/entities/Mario.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Go from '../traits/Go.js';
import Jump from '../traits/Jump.js';
import Killable from '../traits/Killable.js';
import Physics from '../traits/Physics.js';
import PipeTraveller from '../traits/PipeTraveller.js';
import Solid from '../traits/Solid.js';
import Stomper from '../traits/Stomper.js';
import {loadAudioBoard} from '../loaders/audio.js';
Expand Down Expand Up @@ -60,6 +61,7 @@ function createMarioFactory(sprite, audio) {
mario.addTrait(new Jump());
mario.addTrait(new Killable());
mario.addTrait(new Stomper());
mario.addTrait(new PipeTraveller());

mario.traits.get(Killable).removeAfter = Infinity;
mario.traits.get(Jump).velocity = 175;
Expand Down
15 changes: 8 additions & 7 deletions public/js/layers/collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ function createEntityLayer(entities) {
entities.forEach(entity => {
context.beginPath();
context.rect(
entity.bounds.left - camera.pos.x,
entity.bounds.top - camera.pos.y,
entity.size.x,
entity.size.y);
Math.floor(entity.bounds.left - camera.pos.x) + .5,
Math.floor(entity.bounds.top - camera.pos.y) + .5,
entity.size.x - 1,
entity.size.y -1);
context.stroke();
});
};
Expand All @@ -29,9 +29,10 @@ function createTileCandidateLayer(tileResolver) {
resolvedTiles.forEach(({x, y}) => {
context.beginPath();
context.rect(
x * tileSize - camera.pos.x,
y * tileSize - camera.pos.y,
tileSize, tileSize);
Math.floor(x * tileSize - camera.pos.x) + .5,
Math.floor(y * tileSize - camera.pos.y) + .5,
tileSize - 1,
tileSize - 1);
context.stroke();
});

Expand Down

0 comments on commit 91faafb

Please sign in to comment.