Skip to content

Commit

Permalink
chore(sprites): add bubbie and pokey
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 22, 2025
1 parent c226190 commit d1674bd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
Binary file added public/sprites/bubbie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sprites/pokey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/constants/sprites.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export enum Sprite {
Bean = 'Bean',
Bubbie = 'Bubbie',
Ghosty = 'Ghosty',
Pokey = 'Pokey',
}
3 changes: 2 additions & 1 deletion src/gameobjects/enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import type { Player } from '../types'

export function addEnemy(x: number, y: number, player: Player) {
const speed = rand(100, 300)
const sprites = [Sprite.Bubbie, Sprite.Pokey]

const enemy = add([
sprite(Sprite.Ghosty),
sprite(sprites[randi(sprites.length)]),
pos(x, y),
anchor('center'),
health(100),
Expand Down
11 changes: 9 additions & 2 deletions src/scenes/preload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { Scene, Sprite } from '../constants'

scene(Scene.Preload, () => {
loadSprite(Sprite.Bean, 'sprites/bean.png')
loadSprite(Sprite.Ghosty, 'sprites/ghosty.png')
;[
[Sprite.Bean, 'sprites/bean.png'],
[Sprite.Bubbie, 'sprites/bubbie.png'],
[Sprite.Ghosty, 'sprites/ghosty.png'],
[Sprite.Pokey, 'sprites/pokey.png'],
].forEach(([name, src]) => {
loadSprite(name, src)
})

go(Scene.Game)
})

0 comments on commit d1674bd

Please sign in to comment.