Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(6 edits) (+1)

Thanks for the feedback! I'll have this bug squashed in version 0.0.2 : )

I'm glad you like the game.

a.d. question: Well, It depends on what you use for rendering in js - assuming canvas you just do this:

```
drawSprite(ctx, image, x, y, isFlipped) {
  ctx.save();
  ctx.translate(x + (isFlipped ? image.width : 0), y);
  ctx.scale(isFlipped ? -1 : 1, 1);
  ctx.drawImage(image, 0, 0);
  ctx.restore();
}
```
image has to be loaded already
x, y is where you want your top-left corner to be
note image.width added to position but only when the whole thing is flipped

Consider this one to understand how .translate and .scale work together and how the order of them matters (you don't need to understand transformation matrices to use it properly but experiment with .translate, .scale, and .rotate = shuffle them around and see what happens):

```
drawSprite(ctx, image, x, y, isFlipped) {
  var dirX = isFlipped ? -1 : 1;
  ctx.save();
  ctx.scale(dirX, 1);
  ctx.drawImage(image, dirX * (x + (isFlipped ? image.width : 0)), y);
  ctx.restore();
}
```

note that: `drawImage(x, y)` is basically the same as ` translate(x, y); drawImage(0, 0)`

Good luck!

Hm.   I do use canvas but my stupidity and overuse of stackoverflow basically leaves me with a bunch of unorganized spaghetti code, so I'll rewrite it with your tips.  Thanks for your help!

(+1)

Good luck!