Skip to content

Commit aeea049

Browse files
committed
Added Flash Drive gameobject for future quest
1 parent 0d21d27 commit aeea049

6 files changed

Lines changed: 40 additions & 6 deletions

File tree

204 Bytes
Loading

src/gameObjects/map_city/jessica.gameObject.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export const jessica = (k, map, spawnpoints) => {
1111
sliceY: sliceY,
1212
anims: {
1313
'idle-down': spritePosition + 0,
14-
'walk-down': { from: spritePosition + 5, to: spritePosition + 6, loop: true, speed: 4 },
15-
'idle-up': spritePosition + 1,
16-
'walk-up': { from: spritePosition + 7, to: spritePosition + 8, loop: true, speed: 4 },
17-
'idle-right': spritePosition + 2,
1814
},
1915
});
2016

@@ -25,7 +21,7 @@ export const jessica = (k, map, spawnpoints) => {
2521
}),
2622
k.body({ isStatic: true }),
2723
k.anchor('center'),
28-
k.pos(390, 520),
24+
k.pos(map.pos.x + 390, map.pos.y + 520),
2925
k.scale(scaleFactor * 0.5),
3026
k.offscreen({ hide: true, distance: 10 }),
3127
'jessica',
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const flashDrive = (k, map, spawnpoints) => {
2+
k.loadSprite('flashDrive', './assets/sprites/flashdrive.png');
3+
4+
5+
const flashDriveObj = k.make([
6+
k.sprite('flashDrive'),
7+
k.area({
8+
shape: new k.Rect(k.vec2(0), 16, 16),
9+
}),
10+
k.body({ isStatic: true }),
11+
k.anchor('center'),
12+
k.pos(
13+
map.pos.x + 52,
14+
map.pos.y + 150
15+
),
16+
k.scale(0.5),
17+
k.offscreen({ hide: true, distance: 10 }),
18+
'flashDrive',
19+
]);
20+
21+
return flashDriveObj;
22+
};
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { butterfly } from './butterfly.gameObject';
2+
import { flashDrive } from './flashdrive.gameObject';
23

3-
const gameObjects = [butterfly];
4+
const gameObjects = [butterfly, flashDrive];
45

56
export default gameObjects;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { displayDialogue } from '../../utils';
2+
import { interactionHandler } from '../handler.interactions';
3+
4+
export const interactionWithFlashDrive = (player, k, map) => {
5+
interactionHandler(player, 'flashDrive', k, () => {
6+
displayDialogue({
7+
k,
8+
player,
9+
characterName: 'flashDrive',
10+
text: ["You found a flash drive in the the forest. You wonder who it might belong to?"]
11+
});
12+
});
13+
};

src/interactions/map_forest/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { interactionWithHole } from './hole.interactions';
88
import { interactionWithFlower } from './flower.interactions';
99
import { interactionWithFirepit } from './firepit.interactions';
1010
import { interactionWithPond } from './pond.interactions';
11+
import { interactionWithFlashDrive } from './flashDrive.interactions';
1112

1213
const interactions = [
1314
enterMapForestJunctionInteraction,
@@ -20,6 +21,7 @@ const interactions = [
2021
interactionWithFlower,
2122
interactionWithFirepit,
2223
interactionWithPond,
24+
interactionWithFlashDrive,
2325
];
2426

2527
export default interactions;

0 commit comments

Comments
 (0)