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