From af39f2e08b0503db723ae707a5c7278d8c85f812 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <clyne@bitgloo.com> Date: Tue, 1 Oct 2019 20:50:28 -0400 Subject: Audio component loading, getting ready to play --- Scripts/init.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Scripts') diff --git a/Scripts/init.lua b/Scripts/init.lua index ec9e350..ea5a833 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -37,6 +37,9 @@ player = { }, Physics = 0, Name = "bord", + Audio = { + file = "Assets/jump.wav" + }, hellotrue = true, hellofalse = false, Render = { -- cgit v1.2.3 From 9d79ba461a399ce5c211dc7ca2fc49b8934c1cd7 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <clyne@bitgloo.com> Date: Tue, 1 Oct 2019 20:57:25 -0400 Subject: sound on jump --- Scripts/init.lua | 1 + src/engine.cpp | 3 +++ 2 files changed, 4 insertions(+) (limited to 'Scripts') diff --git a/Scripts/init.lua b/Scripts/init.lua index ea5a833..d09fb14 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -21,6 +21,7 @@ player = { end, JumpKeyPressed = function(self) if self.Physics.standing == true then + game.play(self.Position, self.Audio) self.Velocity.y = self.Velocity.y + 9 end end, diff --git a/src/engine.cpp b/src/engine.cpp index ed5ba07..c6bec27 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -66,6 +66,9 @@ int Engine::init(void) script->addToGameNamespace("puts", bindInstance(&TextSystem::put, systems.system<TextSystem>().get())); + script->addToGameNamespace("play", + bindInstance(&AudioSystem::playSound, + systems.system<AudioSystem>().get())); script->init(); -- cgit v1.2.3 From 16a29df61f6cbc546123c91a0b72d1bfb68d6de2 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <clyne@bitgloo.com> Date: Wed, 2 Oct 2019 13:51:26 -0400 Subject: beautiful ball bounce sound --- Assets/boing.wav | Bin 0 -> 605018 bytes Scripts/init.lua | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 Assets/boing.wav (limited to 'Scripts') diff --git a/Assets/boing.wav b/Assets/boing.wav new file mode 100644 index 0000000..a142197 Binary files /dev/null and b/Assets/boing.wav differ diff --git a/Scripts/init.lua b/Scripts/init.lua index d09fb14..96e031a 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -80,10 +80,14 @@ ball = { }, Idle = function(self) if self.Physics.standing == true then + game.play(self.Position, self.Audio) self.Velocity.y = self.Velocity.y + 15 self.Velocity.x = math.random(-1, 1); end end, + Audio = { + file = "Assets/boing.wav" + }, } -- Create the world -- cgit v1.2.3