From 1a048f79f7e9df3ac8b8b848b2d07ae78eb6b043 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Wed, 4 Nov 2020 23:18:47 +0000 Subject: [PATCH] working on doors --- internal/sim/door.go | 53 +++++++++++++++++++++++++++++++++---------- internal/sim/world.go | 15 +++++++++++- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/internal/sim/door.go b/internal/sim/door.go index 38a5193..709ecc9 100644 --- a/internal/sim/door.go +++ b/internal/sim/door.go @@ -8,6 +8,8 @@ import ( type door struct { *blammo.Log + to string + exit int } func (d *door) update(time.Duration) {} @@ -26,18 +28,45 @@ func (d *door) onStopOverlap(e *entity) { /* + ┌──────────┐ + │··········│ + │·····@····│ + │··········│ + │··········│ ┌────────────────────┐ + │··········│ │····················│ + │·····d···◇│--------│◇···················│ + │··········│ │····················│ + │··········│ └────────────────────┘ + │··········│ + │·········◇│ + └──────────┘ -┌──────────┐ -│··········│ -│··········│ -│··········│ ┌──────┐ -│··········│ │ │ -│··········│ │ │ -│·····d····◇░░░░░░░░◇ │ -│··········│ │ │ -│··········│ │ │ -│··········│ └──────┘ -│··········◇ -└──────────┘ + + ┌──────────┐ + │··········│ + │·····@····│ + │··········│ + │··········│ ┌────────────────────┐ + │··········│ │····················│ + │·····d····◇--------◇····················│ + │··········│ │····················│ + │··········│ └────────────────────┘ + │··········│ + │·········◇│ + └──────────┘ + + + ┌──────────┐ + │··········│ + │·····@····│ + │··········│ + │··········│────────────────────┐ + │··········│····················│ + │·····d····◇····················│ + │··········│····················│ + │··········│────────────────────┘ + │··········│ + │·········◇│ + └──────────┘ */ diff --git a/internal/sim/world.go b/internal/sim/world.go index 2fe69c5..487352f 100644 --- a/internal/sim/world.go +++ b/internal/sim/world.go @@ -66,7 +66,9 @@ func newWorld(log *blammo.Log) *world { Position: math.Vec{9, 5}, Glyph: '◇', behavior: &door{ - Log: log.Child("door"), + Log: log.Child("door"), + to: "hall", + exit: -5, }, }) @@ -78,6 +80,17 @@ func newWorld(log *blammo.Log) *world { players: make(map[string]*player), } + hall.addEntity(&entity{ + ID: -5, + Position: math.Vec{0, 2}, + Glyph: '◇', + behavior: &door{ + Log: log.Child("door"), + to: "foyer", + exit: -4, + }, + }) + log.Info("created foyer with bounds: %#v having width: %d height: %d area: %d", foyer.Rect, foyer.Width, foyer.Height, foyer.Area()) return &world{ Log: log,