From d10f7d190c7d6477bc4ca64758072f5e0c21f538 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Tue, 28 May 2019 21:43:30 -0700 Subject: [PATCH] Return False: Solid Collision Between Actors * Implement the handler code for `return false` when actors are colliding with each other and wish to act like solid walls. * The locked doors will `return false` when they're closed and the colliding actor does not have the matching key. * Add arbitrary key/value storage to Actors. The colored keys will set an actor value "key:%TITLE%" on the one who touched the key before destroying itself. The colored doors check that key when touched to decide whether to open. * The trapdoor now only opens if you're touching it from the top (your overlap box Y value is 0), but if you touch it from below and the door is closed, it acts like a solid object. --- rect_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rect_test.go b/rect_test.go index c6d8bb4..f0528c1 100644 --- a/rect_test.go +++ b/rect_test.go @@ -54,6 +54,16 @@ func TestIntersection(t *testing.T) { B: newRect(0, -240, 874, 490), Expect: false, // XXX: must be true }, + { + A: newRect(0, 30, 9, 62), + B: newRect(16, 0, 32, 64), + Expect: false, + }, + { + A: newRect(0, 30, 11, 62), + B: newRect(7, 4, 17, 28), + Expect: false, + }, } for _, test := range tests {