Skip to content

Commit

Permalink
update sample
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Feb 21, 2024
1 parent fa2a05d commit ce6b2fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import { Resources, loader } from './resources';
const game = new ex.Engine({
width: 800,
height: 600,
displayMode: ex.DisplayMode.FitScreenAndFill,
pixelArt: true,
pixelRatio: 2
});

game.start(loader).then(() => {
Resources.SpriteFusionMap.addToScene(game.currentScene);




const playerLayer = Resources.SpriteFusionMap.layers.find(l => l.data.name === "Player");
if (playerLayer) {

Expand All @@ -31,7 +29,7 @@ game.start(loader).then(() => {
const tile = playerLayer.tilemap.getTile(playerTile.x, playerTile.y);
const player = playerLayer.entities.find(e => e.name === 'Player');
game.currentScene.camera.pos = tile.pos;
game.currentScene.camera.zoom = 4;
game.currentScene.camera.zoom = 6;
game.currentScene.camera.strategy.lockToActor(player as ex.Actor);
if (mapBounds) {
game.currentScene.camera.strategy.limitCameraBounds(mapBounds)
Expand Down
1 change: 1 addition & 0 deletions src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const Resources = {
SpriteFusionMap: new SpriteFusionResource({
mapPath,
spritesheetPath,
useTileMapCameraStrategy: true,
entityTileIdFactories: {
2: (props) => {
const player = new Player(props.worldPos);
Expand Down

0 comments on commit ce6b2fc

Please sign in to comment.