Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interaction for computer in room 1 + fix formatting in other files to pass CI checks #63

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gameObjects/map_start/jokeTellerNPC.gameObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const jokeTellerNPC = (k, map, spawnpoints) => {
},
});

const spawnPoint = spawnpoints.jokeTeller || { x: 90, y: 250 };
const spawnPoint = spawnpoints.jokeTeller || { x: 90, y: 280 };

return k.make([
k.sprite('jokeTeller', { anim: 'idle-down' }),
Expand Down
21 changes: 21 additions & 0 deletions src/interactions/map_start/computer.interaction.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
import { displayDialogueWithoutCharacter } from '../../utils';

const careerPathDialogue = `
<div>
<h2>Zero To Mastery Career Paths</h2>
<p>
Whether you’re a complete beginner or an experienced professional, figuring out the
next step in your career can be overwhelming.
</p>
<p>
Our curated Career Paths provide you with the step-by-step roadmap you need to take you from any level, to getting hired
and advancing your career.
</p>
<p>
<a href="https://zerotomastery.io/career-paths/" style="color: #007BFF; text-decoration: none;" target='_blank'>Pick a Career Path here</a> and start your journey.
</p>
</div>
`;

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

player.onCollide('computer', () => {
computer.play('on');
displayDialogueWithoutCharacter(careerPathDialogue);
});

player.onCollideEnd('computer', () => {
computer.play('off');
});
Expand Down
4 changes: 3 additions & 1 deletion src/interactions/map_start/jokeTeller.interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export const interactionWithJokeTeller = (player, k, map) => {

const fetchJoke = async (player, k) => {
try {
const response = await fetch('https://v2.jokeapi.dev/joke/Any?safe-mode');
const response = await fetch(
'https://v2.jokeapi.dev/joke/Any?safe-mode'
);
if (!response.ok) {
throw new Error('Network response was not ok');
}
Expand Down