85 lines
2.3 KiB
Lua

local utils = require "scripts.utils"
local mobdebug = require "builtins.scripts.mobdebug"
local genv = _G or _ENV
local jit = rawget(genv, "jit")
if jit then
print("turning jit off")
jit.off()
jit.opt.start(0) -- Disable all optimizations (set optimization level to 0)
end
function init(self)
msg.post(".", "acquire_input_focus")
end
function final(self)
-- Add finalization code here
-- Learn more: https://defold.com/manuals/script/
-- Remove this function if not needed
end
function update(self, dt)
-- Add update code here
-- Learn more: https://defold.com/manuals/script/
-- Remove this function if not needed
end
function fixed_update(self, dt)
-- This function is called if 'Fixed Update Frequency' is enabled in the Engine section of game.project
-- Can be coupled with fixed updates of the physics simulation if 'Use Fixed Timestep' is enabled in
-- Physics section of game.project
-- Add update code here
-- Learn more: https://defold.com/manuals/script/
-- Remove this function if not needed
end
function on_message(self, message_id, message, sender)
-- Add message-handling code here
-- Learn more: https://defold.com/manuals/message-passing/
-- Remove this function if not needed
end
local function another_one(one, two)
local three = one + two
print(three)
return three
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed then
print("JIT status:", jit.status())
self.next_state = "moving"
local tx, ty = utils.screen_to_world(action.screen_x, action.screen_y, 0, "/CameraParent#camera")
local three = another_one(5, 10)
self.target_pos = vmath.vector3(tx, ty, 0)
local testing = three + 10
print(testing)
local another_test = testing + 100
print(another_test)
self.another_test = another_test
return false
elseif action_id == hash("right-click") and action.pressed then
print(self.another_test + 10)
-- msg.post(receiver, message_id, message)
end
end
function on_reload(self)
msg.post(".", "acquire_input_focus")
end
-- local function list_breakpoints()
-- local result = {}
-- for file, lines in pairs(breakpoints) do
-- for line, _ in pairs(lines) do
-- table.insert(result, {file = file, line = line})
-- end
-- end
-- return result
-- end
-- mobdebug.list_breakpoints = list_breakpoints