Skip to content

Commit

Permalink
demo - menu test
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Nov 16, 2024
1 parent c3458f4 commit 6998511
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/maps/demo/close_menu.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
player = {}
Editor.setPropertyType(this, "player", Editor.ENTITY_PROPERTY)

function onButtonClicked()
this.parent.gui_rect.enabled = false
this.world:getModule("gui"):getSystem():enableCursor(false)
player.lua_script[1].handle_input = true
end
Binary file modified data/maps/demo/demo.unv
Binary file not shown.
12 changes: 12 additions & 0 deletions data/maps/demo/open_menu.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
inherit "maps/demo/button"

gui = {}
player = {}
Editor.setPropertyType(this, "gui", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "player", Editor.ENTITY_PROPERTY)

function buttonPressed()
gui.gui_rect.enabled = true
this.world:getModule("gui"):getSystem():enableCursor(true)
player.lua_script[1].handle_input = false
end
Binary file modified data/navzones/7470683995146639429.nav
Binary file not shown.
3 changes: 3 additions & 0 deletions data/scripts/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ local crouched = false
local aiming = false
camera_pivot = -1
Editor.setPropertyType(this, "camera_pivot", Editor.ENTITY_PROPERTY)
handle_input = true

function onInputEvent(event : InputEvent)
if not handle_input then return end

if event.type == "axis" and event.device.type == "mouse" then
yaw = yaw + event.x * -0.01
pitch = pitch + event.y * -0.01
Expand Down

0 comments on commit 6998511

Please sign in to comment.