Skip to content

Commit be08887

Browse files
committed
2 parents 6a1a310 + d268f4f commit be08887

18 files changed

Lines changed: 198 additions & 66 deletions
204 Bytes
Loading

public/maps/map_city.json

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@
27622762
"y":591.594703333333
27632763
},
27642764
{
2765-
"height":6.47251215874179,
2765+
"height":9.14406044557266,
27662766
"id":400,
27672767
"name":"campus_house_door_1",
27682768
"rotation":0,
@@ -2819,7 +2819,7 @@
28192819
{
28202820
"height":21.1875,
28212821
"id":405,
2822-
"name":"snack_bar_green",
2822+
"name":"snack_bar_green_1",
28232823
"rotation":0,
28242824
"type":"",
28252825
"visible":true,
@@ -2841,7 +2841,7 @@
28412841
{
28422842
"height":25,
28432843
"id":407,
2844-
"name":"snack_bar_green",
2844+
"name":"snack_bar_green_2",
28452845
"rotation":0,
28462846
"type":"",
28472847
"visible":true,
@@ -3477,28 +3477,6 @@
34773477
"x":923,
34783478
"y":295.466
34793479
},
3480-
{
3481-
"height":24.1818,
3482-
"id":434,
3483-
"name":"boundary_park_bench",
3484-
"rotation":0,
3485-
"type":"",
3486-
"visible":true,
3487-
"width":3.81818,
3488-
"x":594.432,
3489-
"y":215.534
3490-
},
3491-
{
3492-
"height":23.6364,
3493-
"id":435,
3494-
"name":"boundary_park_bench",
3495-
"rotation":0,
3496-
"type":"",
3497-
"visible":true,
3498-
"width":3.27273,
3499-
"x":634.614,
3500-
"y":215.898
3501-
},
35023480
{
35033481
"height":14.25,
35043482
"id":436,

src/gameObjects/map_city/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { flyingBirds } from './flyingBirds';
33
import { npcsInCityMap } from './npcsOnmap_city';
44
import { soccerBall } from './soccerBall.gameObject';
55
import { americanFootball } from './americanFootball.gameObject';
6+
import { jessica } from './jessica.gameObject';
67

78
const gameObjects = [
89
npcsInCityMap,
@@ -11,6 +12,7 @@ const gameObjects = [
1112
flyingBirds,
1213
soccerBall,
1314
americanFootball,
15+
jessica,
1416
];
1517

1618
export default gameObjects;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { scaleFactor } from '../../constants';
2+
3+
const characterRow = 17;
4+
const sliceX = 10;
5+
const sliceY = 20;
6+
const spritePosition = (characterRow - 1) * sliceX;
7+
8+
export const jessica = (k, map, spawnpoints) => {
9+
k.loadSprite('jessica', './assets/sprites/characters.png', {
10+
sliceX: sliceX,
11+
sliceY: sliceY,
12+
anims: {
13+
'idle-down': spritePosition + 0,
14+
},
15+
});
16+
17+
const jessicaObj = k.make([
18+
k.sprite('jessica', { anim: 'idle-down' }),
19+
k.area({
20+
shape: new k.Rect(k.vec2(0), 16, 16),
21+
}),
22+
k.body({ isStatic: true }),
23+
k.anchor('center'),
24+
k.pos(map.pos.x + 390, map.pos.y + 520),
25+
k.scale(scaleFactor * 0.5),
26+
k.offscreen({ hide: true, distance: 10 }),
27+
'jessica',
28+
]);
29+
30+
return jessicaObj;
31+
};

src/gameObjects/map_city/npcsOnmap_city.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ export const npcsInCityMap = (k, map, spawnpoints) => {
3939
// Define patterns and their corresponding adjustments
4040
const npcPatterns = [
4141
{
42-
patterns: [/stall_/],
42+
patterns: [/stall_1/],
4343
adjustments: { xAdjust: 12, yAdjust: 18 },
4444
direction: 'idle-down',
4545
},
4646
{
47-
patterns: [/snack_bar_/],
47+
patterns: [/stall_2/],
48+
adjustments: { xAdjust: 12, yAdjust: 18 },
49+
direction: 'idle-down',
50+
},
51+
{
52+
patterns: [/snack_bar_green_1/],
4853
adjustments: { xAdjust: 12, yAdjust: 18 },
4954
direction: 'idle-down',
5055
},
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export const flashDrive = (k, map, spawnpoints) => {
2+
k.loadSprite('flashDrive', './assets/sprites/flashdrive.png');
3+
4+
const flashDriveObj = k.make([
5+
k.sprite('flashDrive'),
6+
k.area({
7+
shape: new k.Rect(k.vec2(0), 16, 16),
8+
}),
9+
k.body({ isStatic: true }),
10+
k.anchor('center'),
11+
k.pos(map.pos.x + 52, map.pos.y + 150),
12+
k.scale(0.5),
13+
k.offscreen({ hide: true, distance: 10 }),
14+
'flashDrive',
15+
]);
16+
17+
return flashDriveObj;
18+
};
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;

src/interactions/map_city/boundaryBurgerBar.interaction.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ export const boundaryBurgerBarInteraction = (player, k) => {
88
k,
99
player,
1010
text: ['Hello! Would you like a burger?'],
11+
purchaseCost: 25,
1112
});
1213

1314
if (wantBurger) {
14-
k.debug.log('Enjoy your burger!'); //testing purposes you may uncomment it or add displayPermission box your wish
1515
const purchaseStatus = purchaseItem(k, 25, 40);
1616
if (purchaseStatus === 'purchased') {
17+
k.debug.log('Enjoy your burger!'); //testing purposes you may uncomment it or add displayPermission box your wish
1718
updateAchievements('Food enthusiast', 'Burger Store');
1819
}
1920
} else {

src/interactions/map_city/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { enterMapSeasideInteraction } from './enterMapSeasideInteraction.interac
1616
import { enterMapExtendedCampus } from './enterMapExtendedCampus.interactions';
1717
import { enterMapExtendedCampusTop } from './enterMapExtendCampusTop.interactions';
1818
import { interactionWithBin } from './bin.interaction';
19+
import { jessicaInteraction } from './jessica.interation';
20+
import { interactionWithSoccerBall } from './soccerBall.interaction';
1921

2022
const interactions = [
2123
enterMapArcadeInteraction,
@@ -36,6 +38,8 @@ const interactions = [
3638
// Add more interactions here
3739
enterMapCampusHouse1Interaction,
3840
interactionWithBin,
41+
jessicaInteraction,
42+
interactionWithSoccerBall,
3943
];
4044

4145
export default interactions;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { interactionHandler } from '../handler.interactions';
2+
import { displayDialogue } from '../../utils';
3+
4+
export const jessicaInteraction = (player, k) => {
5+
interactionHandler(player, 'jessica', k, async () => {
6+
await displayDialogue({
7+
k,
8+
player,
9+
characterName: 'Jessica',
10+
text: [
11+
"Hi, I'm Jessica! I'm learning Javascript! It's a lot of work, but I'm excited to get better at it.",
12+
],
13+
});
14+
});
15+
};

0 commit comments

Comments
 (0)