From 72603f1641bb400be6c9b0604273a4bd38932136 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 17 Nov 2022 13:47:16 -0500 Subject: ui-coord mouse interacts with world-coord entity --- Scripts/init.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Scripts/init.lua') diff --git a/Scripts/init.lua b/Scripts/init.lua index fde6c86..1ae2efc 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -24,12 +24,16 @@ player = { end end, JumpKeyReleased = function(self) - game.dialog(30, 50, 400, 100) - game.puts("dialog", 36, 52, "Hey. Hag?") end, MousePressed = function(self, mx, my) - if mx > 30 and mx < 430 and my > 50 and my < 150 then - game.dialogClear() + mp = game.uiToWorldCoord(mx, my) + if math.abs(mp.x - self.Position.x) < 1 and math.abs(mp.y - self.Position.y) < 1 then + game.dialog(30, 50, 400, 100) + game.puts("dialog", 36, 52, "What do you think you're doing?") + else + if mx > 30 and mx < 430 and my > 50 and my < 150 then + game.dialogClear() + end end end }, -- cgit v1.2.3