Sounds are working
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import standard;
|
||||
import node;
|
||||
import sound;
|
||||
|
||||
|
||||
//constants
|
||||
@@ -29,6 +30,9 @@ var attackPositionY: int = null;
|
||||
var walkAnimationCounter: int = 0;
|
||||
var attackAnimationCounter: int = 0;
|
||||
|
||||
//audio utils
|
||||
var kickSound: opaque = null;
|
||||
|
||||
|
||||
//accessors & mutators
|
||||
fn setGridPosition(node: opaque, x: int, y: int) {
|
||||
@@ -65,6 +69,8 @@ fn getAttackPositionY(node: opaque) {
|
||||
fn onLoad(node: opaque) {
|
||||
node.loadNodeTexture("sprites:/parvati.png"); //NOTE: all of this script is mapped to this sprite sheet
|
||||
node.faceDirection(DIRECTION_DOWN);
|
||||
|
||||
kickSound = loadSound("sound:/attack.ogg");
|
||||
}
|
||||
|
||||
//fn onUpdate(node: opaque, delta: int) {
|
||||
@@ -159,6 +165,7 @@ fn onStep(node: opaque) {
|
||||
|
||||
fn onFree(node: opaque) {
|
||||
node.freeNodeTexture();
|
||||
kickSound.freeSound();
|
||||
}
|
||||
|
||||
fn onDraw(node: opaque) {
|
||||
@@ -203,6 +210,8 @@ fn onKeyDown(node: opaque, event: string) {
|
||||
node.setAttackPosition(gridPositionX - 1, gridPositionY);
|
||||
}
|
||||
|
||||
kickSound.playSound();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user