Skip to content

Commit

Permalink
Allowed teleporting, added restart to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochili committed Jul 30, 2022
1 parent 227e4e1 commit 9f5f65b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions example/hint.gui
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ nodes {
}
size {
x: 380.0
y: 100.0
y: 120.0
z: 0.0
w: 1.0
}
Expand Down Expand Up @@ -156,6 +156,7 @@ nodes {
text: "[WASD] - Move\n"
"[Left Shift] - Run\n"
"[Space] - Jump\n"
"[Mouse Wheel] - Zoom\n"
"[C] - Crouch"
font: "system_font"
id: "text"
Expand Down Expand Up @@ -220,8 +221,9 @@ nodes {
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "[Mouse Wheel] - Zoom\n"
text: "[R] - Restart\n"
"[F] - Spectator Mode\n"
" \n"
"[L] - Debug\n"
"[H] - This Hint"
font: "system_font"
Expand Down
6 changes: 5 additions & 1 deletion example/player.script
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function init(self)
urls.model_crouching = msg.url('model#crouching')
urls.model_standing = msg.url('model#standing')

self.restart_position = go.get_position('.')

msg.post('.', hash 'acquire_input_focus')
msg.post(urls.model_crouching, hash 'disable')
msg.post(urls.operator, hash 'follow_point', { object = urls.eyes })
Expand Down Expand Up @@ -58,7 +60,9 @@ function on_message(self, message_id, message, sender)
end

function on_input(self, action_id, action)
if action_id == hash 'key_f' and action.released then
if action_id == hash 'key_r' and action.released then
go.set_position(self.restart_position, '.')
elseif action_id == hash 'key_f' and action.released then
spectator_mode = not spectator_mode
msg.post(urls.walker, hash 'spectator_mode', { is_enabled = spectator_mode } )
elseif action_id == hash 'key_l' and action.released then
Expand Down
2 changes: 1 addition & 1 deletion game.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include_dirs = walker

[project]
title = Kinematic Walker
version = 1.0
version = 1.2
dependencies#0 = https://github.com/indiesoftby/defold-pointer-lock/archive/1b5e05b94491bb7e041052990122dd846e1605a9.zip
dependencies#1 = https://github.com/astrochili/defold-operator/archive/refs/tags/1.3.zip
dependencies#2 = https://github.com/astrochili/defold-trenchbroom/archive/refs/tags/1.1.zip
Expand Down
4 changes: 4 additions & 0 deletions walker/walker.script
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ function update(self, dt)

physics.wakeup(self.collision)

-- Position

self.position = go.get_position('.')

-- Rotation

self.rotation = go.get_rotation('.')
Expand Down

0 comments on commit 9f5f65b

Please sign in to comment.