]> code.bitgloo.com Git - clyne/gamedev2.git/commitdiff
sound on jump
authorClyne Sullivan <clyne@bitgloo.com>
Wed, 2 Oct 2019 00:57:25 +0000 (20:57 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Wed, 2 Oct 2019 00:57:25 +0000 (20:57 -0400)
Scripts/init.lua
src/engine.cpp

index ea5a833b20cdab49b0b31854bd8a799af249d613..d09fb141810224524751db7657e6884a668597d3 100644 (file)
@@ -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,
index ed5ba0717fb22c6f75e2b19c02cdb667b6e5473a..c6bec279ab65e3bd624216d8f220e8092316c510 100644 (file)
@@ -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();