-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
337 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function init(self) | ||
msg.post(".", "acquire_input_focus") | ||
self.scale = (sys.get_config_int("display.high_dpi") == 1) and 2 or 1 | ||
end | ||
|
||
function on_input(self, action_id, action) | ||
if not action_id or action_id == hash("touch") then | ||
if action.pressed then | ||
rive.pointer_down("#model", action.x * self.scale, action.y * self.scale) | ||
elseif action.released then | ||
rive.pointer_up("#model", action.x * self.scale, action.y * self.scale) | ||
else | ||
rive.pointer_move("#model", action.x * self.scale, action.y * self.scale) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scene: "/main/ghost/new_file.riv" | ||
atlas: "/defold-rive/assets/empty.atlas" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
function init(self) | ||
--[[rive.play_anim("#rivemodel", "Timeline 1", go.PLAYBACK_ONCE_FORWARD, nil, function(self, message_id, message) | ||
print("play_anim", message_id) | ||
end)--]] | ||
rive.play_state_machine("#rivemodel", "State Machine 1", nil, function(self, message_id, message) | ||
print("play_state_machine", message_id) | ||
end) | ||
-- 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 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 | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: "ghost" | ||
instances { | ||
id: "back" | ||
prototype: "/main/menu/back.go" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} | ||
scale_along_z: 0 | ||
embedded_instances { | ||
id: "go" | ||
data: "components {\n" | ||
" id: \"ghost\"\n" | ||
" component: \"/main/ghost/ghost.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
" property_decls {\n" | ||
" }\n" | ||
"}\n" | ||
"embedded_components {\n" | ||
" id: \"ui\"\n" | ||
" type: \"rivemodel\"\n" | ||
" data: \"scene: \\\"/main/ghost/ghost.rivescene\\\"\\n" | ||
"default_animation: \\\"Timeline 1\\\"\\n" | ||
"material: \\\"/defold-rive/assets/rivemodel.material\\\"\\n" | ||
"blend_mode: BLEND_MODE_ALPHA\\n" | ||
"default_state_machine: \\\"State Machine 1\\\"\\n" | ||
"create_go_bones: false\\n" | ||
"artboard: \\\"New Artboard\\\"\\n" | ||
"\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 957.0 | ||
y: 529.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} | ||
embedded_instances { | ||
id: "go1" | ||
data: "components {\n" | ||
" id: \"event\"\n" | ||
" component: \"/main/ghost/event.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
" property_decls {\n" | ||
" }\n" | ||
"}\n" | ||
"embedded_components {\n" | ||
" id: \"rivemodel\"\n" | ||
" type: \"rivemodel\"\n" | ||
" data: \"scene: \\\"/main/ghost/event.rivescene\\\"\\n" | ||
"default_animation: \\\"\\\"\\n" | ||
"material: \\\"/defold-rive/assets/rivemodel.material\\\"\\n" | ||
"blend_mode: BLEND_MODE_ALPHA\\n" | ||
"default_state_machine: \\\"State Machine 1\\\"\\n" | ||
"create_go_bones: false\\n" | ||
"artboard: \\\"New Artboard\\\"\\n" | ||
"\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scene: "/main/ghost/recreation_game_v2.riv" | ||
atlas: "/defold-rive/assets/empty.atlas" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function init(self) | ||
msg.post(".", "acquire_input_focus") | ||
self.scale = (sys.get_config_int("display.high_dpi") == 1) and 2 or 1 | ||
end | ||
|
||
function on_input(self, action_id, action) | ||
if not action_id or action_id == hash("touch") then | ||
if action.pressed then | ||
rive.pointer_down("#ui", action.x * self.scale, action.y * self.scale) | ||
elseif action.released then | ||
rive.pointer_up("#ui", action.x * self.scale, action.y * self.scale) | ||
else | ||
rive.pointer_move("#ui", action.x * self.scale, action.y * self.scale) | ||
end | ||
end | ||
end |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.