Bunch of random changes
This commit is contained in:
parent
f1208d5d88
commit
ab7a6984cf
BIN
Backup/huge-atlas.png
(Stored with Git LFS)
Normal file
BIN
Backup/huge-atlas.png
(Stored with Git LFS)
Normal file
Binary file not shown.
0
liveupdate.settings
Normal file
0
liveupdate.settings
Normal file
4
main/Game.go
Normal file
4
main/Game.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
components {
|
||||||
|
id: "game"
|
||||||
|
component: "/scripts/game.script"
|
||||||
|
}
|
||||||
@ -1,7 +1,6 @@
|
|||||||
image: "/assets/V1/Factions/Knights/Troops/Warrior/Blue/Warrior_Blue.png"
|
image: "/assets/V1/Factions/Knights/Troops/Warrior/Blue/Warrior_Blue.png"
|
||||||
tile_width: 192
|
tile_width: 192
|
||||||
tile_height: 192
|
tile_height: 192
|
||||||
collision_groups: "default"
|
|
||||||
animations {
|
animations {
|
||||||
id: "attack1-down"
|
id: "attack1-down"
|
||||||
start_tile: 25
|
start_tile: 25
|
||||||
@ -52,4 +51,3 @@ animations {
|
|||||||
playback: PLAYBACK_LOOP_FORWARD
|
playback: PLAYBACK_LOOP_FORWARD
|
||||||
fps: 12
|
fps: 12
|
||||||
}
|
}
|
||||||
extrude_borders: 2
|
|
||||||
|
|||||||
@ -134,3 +134,31 @@ embedded_instances {
|
|||||||
z: 500.0
|
z: 500.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
embedded_instances {
|
||||||
|
id: "test-atlas"
|
||||||
|
data: "embedded_components {\n"
|
||||||
|
" id: \"sprite\"\n"
|
||||||
|
" type: \"sprite\"\n"
|
||||||
|
" data: \"default_animation: \\\"Lancer\\\"\\n"
|
||||||
|
"material: \\\"/builtins/materials/sprite.material\\\"\\n"
|
||||||
|
"textures {\\n"
|
||||||
|
" sampler: \\\"texture_sampler\\\"\\n"
|
||||||
|
" texture: \\\"/main/test-hugest-atlas.atlas\\\"\\n"
|
||||||
|
"}\\n"
|
||||||
|
"\"\n"
|
||||||
|
" position {\n"
|
||||||
|
" x: 333.0\n"
|
||||||
|
" y: 218.0\n"
|
||||||
|
" z: 1.0\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n"
|
||||||
|
""
|
||||||
|
}
|
||||||
|
embedded_instances {
|
||||||
|
id: "GUI"
|
||||||
|
data: "components {\n"
|
||||||
|
" id: \"overlays\"\n"
|
||||||
|
" component: \"/main/overlays.gui\"\n"
|
||||||
|
"}\n"
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|||||||
443
main/overlays.gui
Normal file
443
main/overlays.gui
Normal file
@ -0,0 +1,443 @@
|
|||||||
|
fonts {
|
||||||
|
name: "default"
|
||||||
|
font: "/builtins/fonts/default.font"
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 532.0
|
||||||
|
y: 335.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
scale {
|
||||||
|
x: 2.0
|
||||||
|
y: 2.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "1000"
|
||||||
|
font: "default"
|
||||||
|
id: "text"
|
||||||
|
parent: "box"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box1"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text1"
|
||||||
|
parent: "box1"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box2"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box3"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text3"
|
||||||
|
parent: "box3"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box4"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text4"
|
||||||
|
parent: "box4"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box5"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text5"
|
||||||
|
parent: "box5"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 514.0
|
||||||
|
y: 140.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box6"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text6"
|
||||||
|
parent: "box6"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 154.0
|
||||||
|
y: 325.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box7"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text7"
|
||||||
|
parent: "box7"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 307.0
|
||||||
|
y: 195.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box8"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text8"
|
||||||
|
parent: "box8"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 339.0
|
||||||
|
y: 45.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box9"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text9"
|
||||||
|
parent: "box9"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 664.0
|
||||||
|
y: 204.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box10"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text10"
|
||||||
|
parent: "box10"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 313.0
|
||||||
|
y: 436.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box11"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text11"
|
||||||
|
parent: "box11"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box12"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text12"
|
||||||
|
parent: "box12"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 142.0
|
||||||
|
y: 149.0
|
||||||
|
}
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
type: TYPE_BOX
|
||||||
|
id: "box13"
|
||||||
|
inherit_alpha: true
|
||||||
|
size_mode: SIZE_MODE_AUTO
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text13"
|
||||||
|
parent: "box13"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
size {
|
||||||
|
x: 200.0
|
||||||
|
y: 100.0
|
||||||
|
}
|
||||||
|
color {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
type: TYPE_TEXT
|
||||||
|
text: "Testing"
|
||||||
|
font: "default"
|
||||||
|
id: "text2"
|
||||||
|
inherit_alpha: true
|
||||||
|
}
|
||||||
|
material: "/builtins/materials/gui.material"
|
||||||
|
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||||
BIN
main/sprites.atlas
(Stored with Git LFS)
BIN
main/sprites.atlas
(Stored with Git LFS)
Binary file not shown.
BIN
main/test-huger-atlas.atlas
(Stored with Git LFS)
Normal file
BIN
main/test-huger-atlas.atlas
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
main/test-hugest-atlas.atlas
(Stored with Git LFS)
Normal file
BIN
main/test-hugest-atlas.atlas
(Stored with Git LFS)
Normal file
Binary file not shown.
0
project.shared_editor_settings
Normal file
0
project.shared_editor_settings
Normal file
41
scripts/TestGuiScript.gui_script
Normal file
41
scripts/TestGuiScript.gui_script
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
function init(self)
|
||||||
|
-- Add initialization code here
|
||||||
|
-- Learn more: https://defold.com/manuals/script/
|
||||||
|
-- Remove this function if not needed
|
||||||
|
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 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
|
||||||
|
|
||||||
|
function on_input(self, action_id, action)
|
||||||
|
-- Add input-handling code here. The game object this script is attached to
|
||||||
|
-- must have acquired input focus:
|
||||||
|
--
|
||||||
|
-- msg.post(".", "acquire_input_focus")
|
||||||
|
--
|
||||||
|
-- All mapped input bindings will be received. Mouse and touch input will
|
||||||
|
-- be received regardless of where on the screen it happened.
|
||||||
|
-- Learn more: https://defold.com/manuals/input/
|
||||||
|
-- Remove this function if not needed
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_reload(self)
|
||||||
|
-- Add reload-handling code here
|
||||||
|
-- Learn more: https://defold.com/manuals/hot-reload/
|
||||||
|
-- Remove this function if not needed
|
||||||
|
end
|
||||||
@ -1,4 +1,14 @@
|
|||||||
local utils = require "scripts.utils"
|
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)
|
function init(self)
|
||||||
msg.post(".", "acquire_input_focus")
|
msg.post(".", "acquire_input_focus")
|
||||||
@ -31,19 +41,44 @@ function on_message(self, message_id, message, sender)
|
|||||||
-- Remove this function if not needed
|
-- Remove this function if not needed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function another_one(one, two)
|
||||||
|
local three = one + two
|
||||||
|
print(three)
|
||||||
|
return three
|
||||||
|
end
|
||||||
|
|
||||||
function on_input(self, action_id, action)
|
function on_input(self, action_id, action)
|
||||||
if action_id == hash("touch") and action.pressed then
|
if action_id == hash("touch") and action.pressed then
|
||||||
|
print("JIT status:", jit.status())
|
||||||
|
|
||||||
self.next_state = "moving"
|
self.next_state = "moving"
|
||||||
local tx, ty, _ = utils.screen_to_world(action.screen_x, action.screen_y, 0, "/CameraParent#camera")
|
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)
|
self.target_pos = vmath.vector3(tx, ty, 0)
|
||||||
elseif action_id == hash("right-click") then
|
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)
|
-- msg.post(receiver, message_id, message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_reload(self)
|
function on_reload(self)
|
||||||
msg.post(".", "acquire_input_focus")
|
msg.post(".", "acquire_input_focus")
|
||||||
-- Add reload-handling code here
|
|
||||||
-- Learn more: https://defold.com/manuals/hot-reload/
|
|
||||||
-- Remove this function if not needed
|
|
||||||
end
|
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
|
||||||
|
|||||||
@ -33,7 +33,7 @@ end
|
|||||||
|
|
||||||
function on_message(self, message_id, message, sender)
|
function on_message(self, message_id, message, sender)
|
||||||
if message_id == hash("collision_response") then
|
if message_id == hash("collision_response") then
|
||||||
print(go.get_id())
|
-- print(go.get_id())
|
||||||
end
|
end
|
||||||
if message_id == hash("trigger_response") then
|
if message_id == hash("trigger_response") then
|
||||||
if message.enter then
|
if message.enter then
|
||||||
|
|||||||
25
scripts/utils.lua
Normal file
25
scripts/utils.lua
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.screen_to_world(x, y, z, camera_id)
|
||||||
|
local projection = camera.get_projection(camera_id)
|
||||||
|
local view = camera.get_view(camera_id)
|
||||||
|
local w, h = window.get_size()
|
||||||
|
|
||||||
|
-- https://defold.com/manuals/camera/#converting-mouse-to-world-coordinates
|
||||||
|
local inv = vmath.inv(projection * view)
|
||||||
|
x = (2 * x / w) - 1
|
||||||
|
y = (2 * y / h) - 1
|
||||||
|
z = (2 * z) - 1
|
||||||
|
local x1 = x * inv.m00 + y * inv.m01 + z * inv.m02 + inv.m03
|
||||||
|
local y1 = x * inv.m10 + y * inv.m11 + z * inv.m12 + inv.m13
|
||||||
|
local z1 = x * inv.m20 + y * inv.m21 + z * inv.m22 + inv.m23
|
||||||
|
|
||||||
|
return x1, y1, z1
|
||||||
|
end
|
||||||
|
|
||||||
|
if true then
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return M
|
||||||
Loading…
x
Reference in New Issue
Block a user