Add fake deer

This commit is contained in:
Ketchetwahmeegwun T. Southall 2022-01-29 22:39:20 -08:00
parent 37b0ace838
commit 8f8519e19b

View File

@ -10,7 +10,7 @@ import { ShapeCircle, ShapePoints } from "../data/sprite"
import { SegmentZone } from "../data/segment"
import { Zone } from "../live/Zone"
import { Entity } from "../live/Entity"
import { isPlayerEntity, PlayerEntity } from "../live/PlayerEntity"
import { AnimalEntity, isAnimalEntity } from "../live/AnimalEntity"
import { Action } from "../live/Action"
import { WorldContext } from "../live/World"
@ -146,7 +146,13 @@ export function GameState(ctx: ContextI): StateI {
}
// Add bogus entity
addEntity(new PlayerEntity('deer.animal.stand.west.0'), 'objects', 300, 100)
let player = new AnimalEntity('deer.animal.stand.west.0')
player.isPlayer = true
addEntity(player, 'objects', 300, 100)
// Add fake others
addEntity(new AnimalEntity('deer.animal.stand.west.0'), 'objects', 200, 200)
ctx.app.stage.addChild(rootContainer)
}
@ -184,7 +190,7 @@ export function GameState(ctx: ContextI): StateI {
}
}
for (let entity of entities) {
if (isPlayerEntity(entity)) {
if (isAnimalEntity(entity) && entity.isPlayer) {
entity.act(desiredActions)
// FIXME: This isn't the right place for this.
rootContainer.position.set(Math.round(ctx.app.renderer.width/2), Math.round(ctx.app.renderer.height/2))
@ -196,7 +202,7 @@ export function GameState(ctx: ContextI): StateI {
// I guess...
entity.sprite.container.x = entity.x
entity.sprite.container.y = entity.y
entity.sprite.container.zIndex = entity.y + (entity.sprite.frame?entity.sprite.frame.originY:0)
entity.sprite.container.zIndex = entity.y + (entity.sprite.frame?entity.sprite.frame.originY??0:0)
}
}