-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
demo - play sound; property animation - option to animate entity's tr…
…ansform
- Loading branch information
Showing
18 changed files
with
348 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CC0 https://opengameart.org/content/town-theme-rpg | ||
CC0 https://opengameart.org/content/512-sound-effects-8-bit-style |
Binary file not shown.
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 @@ | ||
volume = 1.000 | ||
looped = false |
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,38 @@ | ||
local math = require "scripts/math" | ||
local interactive = false | ||
|
||
label = {} | ||
player = {} | ||
sound = -1 | ||
|
||
Editor.setPropertyType(this, "label", Editor.ENTITY_PROPERTY) | ||
Editor.setPropertyType(this, "player", Editor.ENTITY_PROPERTY) | ||
Editor.setPropertyType(this, "sound", Editor.RESOURCE_PROPERTY, "clip") | ||
|
||
function playSound(sound) | ||
local path = this.world.lua_script:getResourcePath(sound) | ||
this.world:getModule("audio"):play(this, path, false) | ||
end | ||
|
||
function update(time_delta) | ||
-- check if player is close | ||
local dist_squared = math.distXZSquared(this.position, player.position) | ||
interactive = dist_squared < 2 | ||
-- animate the label if player is close | ||
label.property_animator.enabled = interactive | ||
end | ||
|
||
function onInputEvent(event : InputEvent) | ||
-- check if player pressed "F" and is close | ||
if interactive and event.type == "button" and event.device.type == "keyboard" then | ||
if event.key_id == string.byte("F") then | ||
if event.down then | ||
-- play the sound | ||
playSound(sound) | ||
-- press (move) the button | ||
this.property_animator.enabled = false | ||
this.property_animator.enabled = true | ||
end | ||
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,16 @@ | ||
{ | ||
type = "Scale X", | ||
keyframes = [ | ||
0, 15, 30], | ||
values = [ | ||
10.000000, 20.000000, 10.000000] | ||
}, | ||
|
||
{ | ||
type = "Scale Y", | ||
keyframes = [ | ||
0, 15, 30], | ||
values = [ | ||
10.000000, 20.000000, 10.000000] | ||
}, | ||
|
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,8 @@ | ||
{ | ||
type = "Local position Z", | ||
keyframes = [ | ||
0, 8, 15], | ||
values = [ | ||
-0.220000, -0.150000, -0.220000] | ||
}, | ||
|
Binary file not shown.
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,11 @@ | ||
shader "/shaders/standard.hlsl" | ||
backface_culling true | ||
layer "default" | ||
texture "" | ||
texture "" | ||
texture "" | ||
uniform "Material color", { 1.000000, 0.000000, 0.000000, 1.000000 } | ||
uniform "Roughness", 0.000000 | ||
uniform "Metallic", 0.000000 | ||
uniform "Emission", 0.000000 | ||
uniform "Translucency", 0.000000 |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.