Ok RoomObjects are now actually actors

This commit is contained in:
Bill Rossi 2025-06-07 08:50:37 -04:00
parent 452969c7be
commit 60e8054ce8
2 changed files with 6 additions and 3 deletions

View File

@ -27,10 +27,15 @@ export default class Game {
}
start() {
this.currentRoom = this.assets.get("sampleRoom")
this.loadRoom(this.assets.get("sampleRoom"))
requestAnimationFrame(this.loop.bind(this))
}
loadRoom(room) {
this.currentRoom = room
this.currentRoom.objects.forEach(roomObject => this.actors.push(roomObject))
}
loop(timestamp) {
const dt = timestamp - this.timestamp
this.timestamp = timestamp
@ -42,7 +47,6 @@ export default class Game {
tick(dt) {
this.actors.forEach(actor => actor.tick(dt))
this.currentRoom.tick(dt)
Object.values(this.events).forEach(e => e.nextFrame())
}

View File

@ -31,7 +31,6 @@ export default class Room {
draw(ctx) {
this.json.layers.forEach(this.drawLayer.bind(this, ctx))
this.objects.forEach(object => object.draw(ctx))
}
drawLayer(ctx, layer) {