Skip to content

Commit

Permalink
Jessie arcade (#85)
Browse files Browse the repository at this point in the history
part of #5
  • Loading branch information
r4pt0s authored Oct 9, 2024
2 parents ae0ce0e + 2a94f27 commit 09bc9da
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,20 @@ export const conversationMisterFu = [
"If you're itching to start your journey, the path lies through that gate.",
"But don't forget to stock up on supplies before you go. It's a long road ahead.",
];


export const jessie = {
name: 'jessie',
frames: [180, 184, 182, 188, 181, 186],
};
export const conversationJessie = [
'Hey there! Welcome to the arcade! Ready to have some fun?',
"Hi! I'm Jessie. Need any tips on the best games here?",
"Hello! Have you tried the new racing game? It's awesome!",
"Welcome! I'm Jessie. Let's see if you can beat my high score!",
'Hey! Looking for a challenge? I can show you the toughest games.',
"Hi there! Don't forget to check out the prize counter after playing!",
"Hello! Need any help finding a game? I'm your go-to guide!",
"Hey! Ready to play? I've got some great game recommendations for you.",
];

5 changes: 5 additions & 0 deletions src/gameObjects/map_arcade/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

import { jessie } from "./jessie.gameObject";

import { npcsInArcadeMap } from './npcsOnmap';

const gameObjects = [
npcsInArcadeMap,
// Add more game objects here
jessie,
];

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

export const jessie = (k, map, spawnpoints) => {
k.loadSprite('jessie', './assets/sprites/characters.png', {
sliceX: 10,
sliceY: 20,
anims: {
'idle-down': 180,
'walk-down': { from: 184, to: 185, loop: true, speed: 4 },
'idle-side': 182,
'walk-side': { from: 188, to: 190, loop: true, speed: 4 },
'idle-up': 181,
'walk-up': { from: 186, to: 199, loop: true, speed: 4 },
},
});

const jessieObj = k.make([
k.sprite('jessie', { 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.x + 40,
map.pos.y + spawnpoints.player.y
),
k.scale(scaleFactor),
k.offscreen({ hide: true, distance: 10 }),
'jessie',
]);

return jessieObj;
};
3 changes: 3 additions & 0 deletions src/interactions/map_arcade/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { interactionWithGameMachine8 } from './game_machine_8';
import { interactionWithGameMachine2 } from './game_machine_2.interactions';
import { interactionWithGameMachine4 } from './game_machine_4.interactions';
import { interactionWithGameMachine6 } from './game_machine_6.interactions';
import { interactionWithJessie } from './jessie.interaction';

const interactions = [
enterMapCityInteraction,
// Add more interactions here

interactionWithJessie,

// new interaction
interactionWithGameMachine2,
interactionWithGameMachine4,
Expand Down
20 changes: 20 additions & 0 deletions src/interactions/map_arcade/jessie.interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

import { interactionHandler } from '../handler.interactions';
import { displayDialogue } from '../../utils';
import { conversationJessie, jessie } from '../../constants';

export const interactionWithJessie = (player, k, map) => {
interactionHandler(player, jessie.name, k, () => {
player.isInDialog = true;
displayDialogue({
k,
player,
characterName: jessie.name,
text: conversationJessie,
onDisplayEnd: () => {
player.isInDialog = false;
player.state.hasTalkedToJessie = true;
},
});
});
};
2 changes: 1 addition & 1 deletion src/interactions/map_start/misterFu.interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export const interactionWithMisterFu = (player, k, map) => {
},
});
});
};
}

0 comments on commit 09bc9da

Please sign in to comment.