Skip to content

Commit

Permalink
Update sprite and animation in main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstrands committed Mar 22, 2024
1 parent 9a59c20 commit f92f637
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ async function main() {
},
});

kb.loadSprite("ground", "tiles/Tileset_10x.png", {
sliceX: 4,
sliceY: 3,
kb.loadSprite("ground", "tiles/Tileset_Cropped_10x.png", {
sliceX: 2,
sliceY: 1,
anims: {
move: {
from: 0,
to: 1,
loop: true,
},
},
});

kb.loadSprite("hunter", "sprites/Hunter_10x.png", {
Expand Down Expand Up @@ -88,7 +95,8 @@ async function main() {
tiled: true,
width: kb.width(),
height: FLOOR_HEIGHT,
frame: 1,
frame: 0,
anim: "move",
}),
kb.area(),
kb.outline(1),
Expand All @@ -102,7 +110,7 @@ async function main() {
kb.sprite("hunter"),
kb.pos(kb.width(), kb.height() - FLOOR_HEIGHT * 3 - 16),
kb.rotate(0),
kb.area({ scale: kb.vec2(0.7, 1), offset: kb.vec2(25, 2) }),
kb.area({ scale: kb.vec2(0.7, 1), offset: kb.vec2(25, 0) }),
kb.anchor("botleft"),
kb.body(),
kb.offscreen({ destroy: true }),
Expand Down Expand Up @@ -194,7 +202,7 @@ async function main() {
});
});

kb.go("gameover");
kb.go("game");
}

main();
Binary file added www/tiles/Tileset_Cropped_10x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f92f637

Please sign in to comment.