Skip to content

Commit

Permalink
Adding misterFu game object (#53)
Browse files Browse the repository at this point in the history
Part of #3
  • Loading branch information
r4pt0s authored Oct 3, 2024
2 parents 43a6a76 + 707da95 commit cbc2f2d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gameObjects/map_start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { cake } from './cake.gameObject';
import { npcsOnChairs } from './npcsOnChairs.gameObject';
import { ztmTrailer } from './ztmTrailer.gameObject';
import { computer } from './computer.gameObject';

import { misterFu } from './misterFu.gameObject';


import { jokeTellerNPC } from './jokeTellerNPC.gameObject';

const gameObjects = [
bruno,
npcsOnChairs,
Expand All @@ -12,6 +17,7 @@ const gameObjects = [
cake,
jokeTellerNPC,
// Add more game objects here
misterFu,
];

export const addGameObjects = (k, map, spawnpoints) => {
Expand Down
33 changes: 33 additions & 0 deletions src/gameObjects/map_start/misterFu.gameObject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { scaleFactor } from '../../constants';

export const misterFu = (k, map, spawnpoints) => {
k.loadSprite('misterFu', './characters.png', {
sliceX: 9,
sliceY: 1,
anims: {
'idle-down': 60,
'walk-down': { from: 64, to: 65, loop: true, speed: 4 },
'idle-side': 62,
'walk-side': { from: 68, to: 69, loop: true, speed: 4 },
'idle-up': 61,
'walk-up': { from: 66, to: 76, loop: true, speed: 4 },
},
});

const misterFuObj = k.make([
k.sprite('misterFu', { anim: 'idle-down' }),
k.area({
shape: new k.Rect(k.vec2(0), 16, 16),
}),
k.body({ isStatic: true }),
k.anchor('center'),
k.pos(
map.pos.x + spawnpoints.player.pos,
map.pos.y + spawnpoints.player.pos
),
k.scale(scaleFactor + 0.5),
'misterFu',
]);

return misterFuObj;
};

0 comments on commit cbc2f2d

Please sign in to comment.