-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2638604
commit 26cb885
Showing
6 changed files
with
1,814 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { scaleFactor } from '../../constants'; | ||
|
||
export const akashi = (k, map, spawnpoints) => { | ||
k.loadSprite('akashi', './assets/sprites/akashi.png', { | ||
sliceX: 9, | ||
sliceY: 1, | ||
anims: { | ||
'idle-down': 0, | ||
'walk-down': { from: 3, to: 4, loop: true, speed: 4 }, | ||
'idle-side': 2, | ||
'walk-side': { from: 7, to: 8, loop: true, speed: 4 }, | ||
'idle-up': 1, | ||
'walk-up': { from: 5, to: 6, loop: true, speed: 4 }, | ||
}, | ||
}); | ||
|
||
const spawnX = spawnpoints.bruno.x / scaleFactor; | ||
const spawnY = spawnpoints.bruno.y / scaleFactor; | ||
|
||
const oppositeX = map.width - spawnX; | ||
const oppositeY = map.height - spawnY; | ||
|
||
const akashiObj = k.make([ | ||
k.sprite('akashi', { anim: 'idle-down' }), | ||
k.area({ | ||
shape: new k.Rect(k.vec2(0), 16, 16), | ||
}), | ||
k.body({ isStatic: true }), | ||
k.anchor('center'), | ||
k.pos(spawnX, spawnY), | ||
k.scale(1.1), | ||
k.offscreen({ hide: true, distance: 10 }), | ||
'akashi', | ||
]); | ||
|
||
akashiObj.moveTo(k.vec2(oppositeX, oppositeY), 50); | ||
|
||
return akashiObj; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { speedByScaleFactor } from '../../constants'; | ||
import { displayDialogue } from '../../utils'; | ||
|
||
const akashiDialogue = [ | ||
` | ||
<div> | ||
<h2>Welcome to ZTM Hacktoberfest!</h2> | ||
<p> | ||
You've arrived at the perfect place to start contributing to open-source projects. | ||
</p> | ||
<p> | ||
Hacktoberfest is a month-long celebration of open-source, and it's a great chance to sharpen your skills, connect with other developers, and make a real impact. | ||
</p> | ||
<p> | ||
Let's get coding and make some meaningful contributions together! | ||
</p> | ||
</div> | ||
`, | ||
]; | ||
|
||
export const interactionWithAkashi = (player, k, map) => { | ||
player.onCollide('akashi', () => { | ||
player.state.speed = speedByScaleFactor * 2.5; | ||
displayDialogue({ | ||
k, | ||
player, | ||
text: akashiDialogue, | ||
}); | ||
}); | ||
|
||
player.onCollideEnd('akashi', () => { | ||
setTimeout(() => { | ||
player.state.speed = speedByScaleFactor; | ||
displayDialogue({ | ||
k, | ||
player, | ||
text: ['Meeting elders'], | ||
}); | ||
}, 10000); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.