Add fake deer
This commit is contained in:
parent
37b0ace838
commit
8f8519e19b
|
@ -10,7 +10,7 @@ import { ShapeCircle, ShapePoints } from "../data/sprite"
|
||||||
import { SegmentZone } from "../data/segment"
|
import { SegmentZone } from "../data/segment"
|
||||||
import { Zone } from "../live/Zone"
|
import { Zone } from "../live/Zone"
|
||||||
import { Entity } from "../live/Entity"
|
import { Entity } from "../live/Entity"
|
||||||
import { isPlayerEntity, PlayerEntity } from "../live/PlayerEntity"
|
import { AnimalEntity, isAnimalEntity } from "../live/AnimalEntity"
|
||||||
import { Action } from "../live/Action"
|
import { Action } from "../live/Action"
|
||||||
import { WorldContext } from "../live/World"
|
import { WorldContext } from "../live/World"
|
||||||
|
|
||||||
|
@ -146,7 +146,13 @@ export function GameState(ctx: ContextI): StateI {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add bogus entity
|
// 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)
|
ctx.app.stage.addChild(rootContainer)
|
||||||
}
|
}
|
||||||
|
@ -184,7 +190,7 @@ export function GameState(ctx: ContextI): StateI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let entity of entities) {
|
for (let entity of entities) {
|
||||||
if (isPlayerEntity(entity)) {
|
if (isAnimalEntity(entity) && entity.isPlayer) {
|
||||||
entity.act(desiredActions)
|
entity.act(desiredActions)
|
||||||
// FIXME: This isn't the right place for this.
|
// 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))
|
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...
|
// I guess...
|
||||||
entity.sprite.container.x = entity.x
|
entity.sprite.container.x = entity.x
|
||||||
entity.sprite.container.y = entity.y
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user