Skip to content

Commit

Permalink
fix: change object location and iteraction (#134)
Browse files Browse the repository at this point in the history
Part of #30
  • Loading branch information
r4pt0s authored Oct 11, 2024
2 parents 1d2f440 + e1113b8 commit 148b2f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/gameObjects/map_campus_house_1/computer.gameObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const computer = (k, map, spawnpoints) => {
k.sprite('computer', { frame: 4 }),
k.area(),
k.pos(
(tableWidth + diningRoomTable.pos.x - 20),
(tableHeight + diningRoomTable.pos.y - 20)
tableWidth + diningRoomTable.pos.x - 20,
tableHeight + diningRoomTable.pos.y - 20
),
k.body({ isStatic: true }),
k.scale(scaleFactor - 0.7),
k.scale(scaleFactor * 0.4),
k.offscreen({ hide: true, distance: 10 }),
'computer',
]);
Expand Down
7 changes: 4 additions & 3 deletions src/interactions/map_campus_house_1/computer.interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ const options = [
];

export const computerInteractions = async (player, k, map) => {
const [computer] = map.query({ include: 'computer' });

player.onCollide('computer', async () => {
const energyUI = document.getElementById('energy-container');
energyUI.style.display = 'none';
const [computer] = k.query({ include: 'computer' });
computer.play('on');

player.isInDialog = true;
computer.play('on');

showCustomPrompt(challengeText, options, async (selectedOption) => {
const response = [];
Expand Down Expand Up @@ -65,7 +67,6 @@ export const computerInteractions = async (player, k, map) => {
player.onCollideEnd('computer', () => {
const energyUI = document.getElementById('energy-container');
energyUI.style.display = 'flex';
const [computer] = k.query({ include: 'computer' });
computer.play('off');
});
};
Expand Down

0 comments on commit 148b2f7

Please sign in to comment.