mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 05:01:38 +00:00
basic sounds
This commit is contained in:
parent
23a435328d
commit
eb59030a76
19 changed files with 185 additions and 45 deletions
30
src/AudioManager.hx
Normal file
30
src/AudioManager.hx
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
package src;
|
||||||
|
|
||||||
|
import hxd.snd.effect.Spatialization;
|
||||||
|
import h3d.Vector;
|
||||||
|
import hxd.res.Sound;
|
||||||
|
import src.Settings;
|
||||||
|
import hxd.snd.ChannelGroup;
|
||||||
|
|
||||||
|
class AudioManager {
|
||||||
|
static var manager:hxd.snd.Manager;
|
||||||
|
static var soundChannel:hxd.snd.ChannelGroup;
|
||||||
|
static var musicChannel:hxd.snd.ChannelGroup;
|
||||||
|
|
||||||
|
public static function init() {
|
||||||
|
AudioManager.manager = hxd.snd.Manager.get();
|
||||||
|
AudioManager.soundChannel = new ChannelGroup("sound");
|
||||||
|
soundChannel.volume = Settings.optionsSettings.soundVolume;
|
||||||
|
AudioManager.musicChannel = new ChannelGroup("music");
|
||||||
|
musicChannel.volume = Settings.optionsSettings.musicVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function playSound(sound:Sound, ?position:Vector) {
|
||||||
|
AudioManager.manager.play(sound, soundChannel);
|
||||||
|
if (position != null) {
|
||||||
|
var audioSrc = new Spatialization();
|
||||||
|
audioSrc.position = position;
|
||||||
|
soundChannel.addEffect(audioSrc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -349,16 +349,17 @@ class DtsObject extends GameObject {
|
||||||
}
|
}
|
||||||
material.shadows = false;
|
material.shadows = false;
|
||||||
if (material.texture == null) {
|
if (material.texture == null) {
|
||||||
var dtsshader = new DtsTexture();
|
// var dtsshader = new DtsTexture();
|
||||||
dtsshader.currentOpacity = 1;
|
// dtsshader.currentOpacity = 1;
|
||||||
// Make a 1x1 white texture
|
// Make a 1x1 white texture
|
||||||
var bitmap = new hxd.BitmapData(1, 1);
|
var bitmap = new hxd.BitmapData(1, 1);
|
||||||
bitmap.setPixel(0, 0, 0xFFFFFF);
|
bitmap.setPixel(0, 0, 0xFFFFFF);
|
||||||
var texture = new Texture(1, 1);
|
var texture = new Texture(1, 1);
|
||||||
texture.uploadBitmap(bitmap);
|
texture.uploadBitmap(bitmap);
|
||||||
dtsshader.texture = texture;
|
material.texture = texture;
|
||||||
material.mainPass.addShader(dtsshader);
|
// dtsshader.texture = texture;
|
||||||
material.receiveShadows = true;
|
// material.mainPass.addShader(dtsshader);
|
||||||
|
// material.shadows = false;
|
||||||
}
|
}
|
||||||
if (flags & 4 > 0) {
|
if (flags & 4 > 0) {
|
||||||
material.blendMode = BlendMode.Alpha;
|
material.blendMode = BlendMode.Alpha;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package;
|
package;
|
||||||
|
|
||||||
|
import src.AudioManager;
|
||||||
import src.Settings;
|
import src.Settings;
|
||||||
import src.MarbleGame;
|
import src.MarbleGame;
|
||||||
import gui.MainMenuGui;
|
import gui.MainMenuGui;
|
||||||
|
|
@ -16,6 +17,7 @@ class Main extends hxd.App {
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
Settings.init();
|
Settings.init();
|
||||||
|
AudioManager.init();
|
||||||
marbleGame = new MarbleGame(s2d, s3d);
|
marbleGame = new MarbleGame(s2d, s3d);
|
||||||
MarbleGame.canvas.setContent(new MainMenuGui());
|
MarbleGame.canvas.setContent(new MainMenuGui());
|
||||||
// world = new MarbleWorld(s3d, s2d, mission);
|
// world = new MarbleWorld(s3d, s2d, mission);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import src.Util;
|
||||||
|
import src.AudioManager;
|
||||||
import src.Settings;
|
import src.Settings;
|
||||||
import h3d.scene.Mesh;
|
import h3d.scene.Mesh;
|
||||||
import h3d.col.Bounds;
|
import h3d.col.Bounds;
|
||||||
|
|
@ -121,6 +123,9 @@ class Marble extends GameObject {
|
||||||
var _minBounceVel = 3;
|
var _minBounceVel = 3;
|
||||||
var _minTrailVel = 10;
|
var _minTrailVel = 10;
|
||||||
var _bounceKineticFriction = 0.2;
|
var _bounceKineticFriction = 0.2;
|
||||||
|
var minVelocityBounceSoft = 2.5;
|
||||||
|
var minVelocityBounceHard = 12.0;
|
||||||
|
var bounceMinGain = 0.2;
|
||||||
|
|
||||||
public var _bounceRestitution = 0.5;
|
public var _bounceRestitution = 0.5;
|
||||||
|
|
||||||
|
|
@ -349,6 +354,11 @@ class Marble extends GameObject {
|
||||||
var velLen = this.velocity.length();
|
var velLen = this.velocity.length();
|
||||||
var surfaceVel = this.contacts[i].normal.multiply(surfaceDot);
|
var surfaceVel = this.contacts[i].normal.multiply(surfaceDot);
|
||||||
|
|
||||||
|
if (!_bounceYet) {
|
||||||
|
_bounceYet = true;
|
||||||
|
playBoundSound(-surfaceDot);
|
||||||
|
}
|
||||||
|
|
||||||
if (noBounce) {
|
if (noBounce) {
|
||||||
this.velocity = this.velocity.sub(surfaceVel);
|
this.velocity = this.velocity.sub(surfaceVel);
|
||||||
} else if (contacts[i].collider != null) {
|
} else if (contacts[i].collider != null) {
|
||||||
|
|
@ -506,6 +516,7 @@ class Marble extends GameObject {
|
||||||
}
|
}
|
||||||
if (sv < this._jumpImpulse) {
|
if (sv < this._jumpImpulse) {
|
||||||
this.velocity = this.velocity.add(bestContact.normal.multiply((this._jumpImpulse - sv)));
|
this.velocity = this.velocity.add(bestContact.normal.multiply((this._jumpImpulse - sv)));
|
||||||
|
AudioManager.playSound(ResourceLoader.getAudio("data/sound/jump.wav"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (j in 0...contacts.length) {
|
for (j in 0...contacts.length) {
|
||||||
|
|
@ -607,6 +618,29 @@ class Marble extends GameObject {
|
||||||
this._bounceNormal = normal;
|
this._bounceNormal = normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function playBoundSound(contactVel:Float) {
|
||||||
|
if (minVelocityBounceSoft <= contactVel) {
|
||||||
|
var hardBounceSpeed = minVelocityBounceHard;
|
||||||
|
var bounceSoundNum = Math.floor(Math.random() * 4);
|
||||||
|
var sndList = [
|
||||||
|
"data/sound/bouncehard1.wav",
|
||||||
|
"data/sound/bouncehard2.wav",
|
||||||
|
"data/sound/bouncehard3.wav",
|
||||||
|
"data/sound/bouncehard4.wav"
|
||||||
|
];
|
||||||
|
var snd = ResourceLoader.getAudio(sndList[bounceSoundNum]);
|
||||||
|
var gain = bounceMinGain;
|
||||||
|
gain = Util.clamp(Math.pow(contactVel / 12, 1.5), 0, 1);
|
||||||
|
|
||||||
|
// if (hardBounceSpeed <= contactVel)
|
||||||
|
// gain = 1.0;
|
||||||
|
// else
|
||||||
|
// gain = (contactVel - minVelocityBounceSoft) / (hardBounceSpeed - minVelocityBounceSoft) * (1.0 - gain) + gain;
|
||||||
|
|
||||||
|
snd.play(false, Settings.optionsSettings.soundVolume * gain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getIntersectionTime(dt:Float, velocity:Vector) {
|
function getIntersectionTime(dt:Float, velocity:Vector) {
|
||||||
var searchbox = new Bounds();
|
var searchbox = new Bounds();
|
||||||
searchbox.addSpherePos(this.x, this.y, this.z, _radius);
|
searchbox.addSpherePos(this.x, this.y, this.z, _radius);
|
||||||
|
|
@ -697,6 +731,8 @@ class Marble extends GameObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_bounceYet = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (timeRemaining <= 0)
|
if (timeRemaining <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
|
import src.AudioManager;
|
||||||
import src.Settings;
|
import src.Settings;
|
||||||
import gui.LoadingGui;
|
import gui.LoadingGui;
|
||||||
import gui.PlayMissionGui;
|
import gui.PlayMissionGui;
|
||||||
|
|
@ -255,7 +257,24 @@ class MarbleWorld extends Scheduler {
|
||||||
this.newOrientationQuat = new Quat();
|
this.newOrientationQuat = new Quat();
|
||||||
this.deselectPowerUp();
|
this.deselectPowerUp();
|
||||||
|
|
||||||
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/spawn.wav'));
|
||||||
|
|
||||||
this.clearSchedule();
|
this.clearSchedule();
|
||||||
|
this.schedule(0.5, () -> {
|
||||||
|
// setCenterText('ready');
|
||||||
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/ready.wav'));
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
this.schedule(2, () -> {
|
||||||
|
// setCenterText('set');
|
||||||
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/set.wav'));
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
this.schedule(3.5, () -> {
|
||||||
|
// setCenterText('go');
|
||||||
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/go.wav'));
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -722,7 +741,7 @@ class MarbleWorld extends Scheduler {
|
||||||
if (this.gemCount == this.totalGems) {
|
if (this.gemCount == this.totalGems) {
|
||||||
string = "You have all the gems, head for the finish!";
|
string = "You have all the gems, head for the finish!";
|
||||||
// if (!this.rewinding)
|
// if (!this.rewinding)
|
||||||
// AudioManager.play('gotallgems.wav');
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/gotallgems.wav'));
|
||||||
|
|
||||||
// Some levels with this package end immediately upon collection of all gems
|
// Some levels with this package end immediately upon collection of all gems
|
||||||
// if (this.mission.misFile.activatedPackages.includes('endWithTheGems')) {
|
// if (this.mission.misFile.activatedPackages.includes('endWithTheGems')) {
|
||||||
|
|
@ -741,7 +760,7 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!this.rewinding)
|
// if (!this.rewinding)
|
||||||
// AudioManager.play('gotgem.wav');
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/gotgem.wav'));
|
||||||
}
|
}
|
||||||
|
|
||||||
displayAlert(string);
|
displayAlert(string);
|
||||||
|
|
@ -817,7 +836,13 @@ class MarbleWorld extends Scheduler {
|
||||||
if (this.finishTime == null) {
|
if (this.finishTime == null) {
|
||||||
if (spherebounds.collide(this.endPad.finishBounds)) {
|
if (spherebounds.collide(this.endPad.finishBounds)) {
|
||||||
if (collision.gjk.GJK.gjk(gjkSphere, this.endPad.finishCollider) != null) {
|
if (collision.gjk.GJK.gjk(gjkSphere, this.endPad.finishCollider) != null) {
|
||||||
touchFinish();
|
if (!endPad.inFinish) {
|
||||||
|
touchFinish();
|
||||||
|
endPad.inFinish = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (endPad.inFinish)
|
||||||
|
endPad.inFinish = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -830,7 +855,7 @@ class MarbleWorld extends Scheduler {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.gemCount < this.totalGems) {
|
if (this.gemCount < this.totalGems) {
|
||||||
// AudioManager.play('missinggems.wav');
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/missinggems.wav'));
|
||||||
displayAlert("You can't finish without all the gems!!");
|
displayAlert("You can't finish without all the gems!!");
|
||||||
} else {
|
} else {
|
||||||
this.endPad.spawnFirework(this.timeState);
|
this.endPad.spawnFirework(this.timeState);
|
||||||
|
|
@ -935,7 +960,7 @@ class MarbleWorld extends Scheduler {
|
||||||
sky.follow = null;
|
sky.follow = null;
|
||||||
// this.oobCameraPosition = camera.position.clone();
|
// this.oobCameraPosition = camera.position.clone();
|
||||||
playGui.setCenterText('outofbounds');
|
playGui.setCenterText('outofbounds');
|
||||||
// AudioManager.play('whoosh.wav');
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/whoosh.wav'));
|
||||||
// if (this.replay.mode != = 'playback')
|
// if (this.replay.mode != = 'playback')
|
||||||
this.schedule(this.timeState.currentAttemptTime + 2, () -> this.restart());
|
this.schedule(this.timeState.currentAttemptTime + 2, () -> this.restart());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
import hxd.res.Image;
|
import hxd.res.Image;
|
||||||
|
import hxd.res.Sound;
|
||||||
import h3d.mat.Texture;
|
import h3d.mat.Texture;
|
||||||
import h3d.scene.Object;
|
import h3d.scene.Object;
|
||||||
import sys.FileSystem;
|
import sys.FileSystem;
|
||||||
|
|
@ -19,6 +20,7 @@ class ResourceLoader {
|
||||||
static var dtsResources:Map<String, DtsFile> = new Map();
|
static var dtsResources:Map<String, DtsFile> = new Map();
|
||||||
static var textureCache:Map<String, Texture> = new Map();
|
static var textureCache:Map<String, Texture> = new Map();
|
||||||
static var imageCache:Map<String, Image> = new Map();
|
static var imageCache:Map<String, Image> = new Map();
|
||||||
|
static var audioCache:Map<String, Sound> = new Map();
|
||||||
|
|
||||||
// static var threadPool:FixedThreadPool = new FixedThreadPool(4);
|
// static var threadPool:FixedThreadPool = new FixedThreadPool(4);
|
||||||
|
|
||||||
|
|
@ -77,6 +79,17 @@ class ResourceLoader {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAudio(path:String) {
|
||||||
|
if (audioCache.exists(path))
|
||||||
|
return audioCache.get(path);
|
||||||
|
if (fileSystem.exists(path)) {
|
||||||
|
var snd = loader.load(path).toSound();
|
||||||
|
audioCache.set(path, snd);
|
||||||
|
return snd;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static function clearInteriorResources() {
|
public static function clearInteriorResources() {
|
||||||
interiorResources = new Map();
|
interiorResources = new Map();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -257,36 +257,6 @@ class OptionsDlg extends GuiImage {
|
||||||
shadowsButton.pressed = true;
|
shadowsButton.pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyFunc = () -> {
|
|
||||||
if (gfx640480.pressed) {
|
|
||||||
Settings.optionsSettings.screenWidth = 640;
|
|
||||||
Settings.optionsSettings.screenHeight = 480;
|
|
||||||
}
|
|
||||||
if (gfx800600.pressed) {
|
|
||||||
Settings.optionsSettings.screenWidth = 800;
|
|
||||||
Settings.optionsSettings.screenHeight = 600;
|
|
||||||
}
|
|
||||||
if (gfx1024768.pressed) {
|
|
||||||
Settings.optionsSettings.screenWidth = 1024;
|
|
||||||
Settings.optionsSettings.screenHeight = 768;
|
|
||||||
}
|
|
||||||
if (gfxFull.pressed)
|
|
||||||
Settings.optionsSettings.isFullScreen = true;
|
|
||||||
else
|
|
||||||
Settings.optionsSettings.isFullScreen = false;
|
|
||||||
if (gfx16.pressed)
|
|
||||||
Settings.optionsSettings.colorDepth = 0;
|
|
||||||
else
|
|
||||||
Settings.optionsSettings.colorDepth = 1;
|
|
||||||
if (gfxopengl.pressed)
|
|
||||||
Settings.optionsSettings.videoDriver = 0;
|
|
||||||
else
|
|
||||||
Settings.optionsSettings.videoDriver = 1;
|
|
||||||
Settings.optionsSettings.shadows = shadowsButton.pressed;
|
|
||||||
|
|
||||||
Settings.applySettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
// AUDIO PANEL
|
// AUDIO PANEL
|
||||||
|
|
||||||
var audioPane = new GuiControl();
|
var audioPane = new GuiControl();
|
||||||
|
|
@ -337,6 +307,39 @@ Renderer: Software
|
||||||
Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
||||||
audTxtWndo.addChild(audInfo);
|
audTxtWndo.addChild(audInfo);
|
||||||
|
|
||||||
|
applyFunc = () -> {
|
||||||
|
if (gfx640480.pressed) {
|
||||||
|
Settings.optionsSettings.screenWidth = 640;
|
||||||
|
Settings.optionsSettings.screenHeight = 480;
|
||||||
|
}
|
||||||
|
if (gfx800600.pressed) {
|
||||||
|
Settings.optionsSettings.screenWidth = 800;
|
||||||
|
Settings.optionsSettings.screenHeight = 600;
|
||||||
|
}
|
||||||
|
if (gfx1024768.pressed) {
|
||||||
|
Settings.optionsSettings.screenWidth = 1024;
|
||||||
|
Settings.optionsSettings.screenHeight = 768;
|
||||||
|
}
|
||||||
|
if (gfxFull.pressed)
|
||||||
|
Settings.optionsSettings.isFullScreen = true;
|
||||||
|
else
|
||||||
|
Settings.optionsSettings.isFullScreen = false;
|
||||||
|
if (gfx16.pressed)
|
||||||
|
Settings.optionsSettings.colorDepth = 0;
|
||||||
|
else
|
||||||
|
Settings.optionsSettings.colorDepth = 1;
|
||||||
|
if (gfxopengl.pressed)
|
||||||
|
Settings.optionsSettings.videoDriver = 0;
|
||||||
|
else
|
||||||
|
Settings.optionsSettings.videoDriver = 1;
|
||||||
|
Settings.optionsSettings.shadows = shadowsButton.pressed;
|
||||||
|
|
||||||
|
Settings.optionsSettings.musicVolume = audMusKnob.sliderValue;
|
||||||
|
Settings.optionsSettings.soundVolume = audSndKnob.sliderValue;
|
||||||
|
|
||||||
|
Settings.applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
// CONTROLS PANEL
|
// CONTROLS PANEL
|
||||||
var controlsPane = new GuiControl();
|
var controlsPane = new GuiControl();
|
||||||
controlsPane.position = new Vector(44, 58);
|
controlsPane.position = new Vector(44, 58);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import h3d.Vector;
|
import h3d.Vector;
|
||||||
|
|
@ -14,6 +15,7 @@ class AntiGravity extends PowerUp {
|
||||||
this.identifier = "AntiGravity";
|
this.identifier = "AntiGravity";
|
||||||
this.pickUpName = "Gravity Modifier";
|
this.pickUpName = "Gravity Modifier";
|
||||||
this.autoUse = true;
|
this.autoUse = true;
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/gravitychange.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.AudioManager;
|
||||||
import h3d.Quat;
|
import h3d.Quat;
|
||||||
import h3d.mat.Material;
|
import h3d.mat.Material;
|
||||||
import h3d.scene.Mesh;
|
import h3d.scene.Mesh;
|
||||||
|
|
@ -24,6 +25,7 @@ class EndPad extends DtsObject {
|
||||||
|
|
||||||
var finishCollider:ConvexHull;
|
var finishCollider:ConvexHull;
|
||||||
var finishBounds:Bounds;
|
var finishBounds:Bounds;
|
||||||
|
var inFinish:Bool = false;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -43,6 +45,7 @@ class EndPad extends DtsObject {
|
||||||
function spawnFirework(time:TimeState) {
|
function spawnFirework(time:TimeState) {
|
||||||
var firework = new Firework(this.getAbsPos().getPosition(), time.timeSinceLoad, this.level);
|
var firework = new Firework(this.getAbsPos().getPosition(), time.timeSinceLoad, this.level);
|
||||||
this.fireworks.push(firework);
|
this.fireworks.push(firework);
|
||||||
|
// AudioManager.playSound(ResourceLoader.getAudio("data/sound/firewrks.wav"));
|
||||||
// AudioManager.play(this.sounds[0], 1, AudioManager.soundGain, this.worldPosition);
|
// AudioManager.play(this.sounds[0], 1, AudioManager.soundGain, this.worldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
@ -13,6 +14,7 @@ class Helicopter extends PowerUp {
|
||||||
this.showSequences = false;
|
this.showSequences = false;
|
||||||
this.identifier = "Helicopter";
|
this.identifier = "Helicopter";
|
||||||
this.pickUpName = "Gyrocopter PowerUp";
|
this.pickUpName = "Gyrocopter PowerUp";
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/pugyrocoptervoice.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.AudioManager;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import collision.CollisionHull;
|
import collision.CollisionHull;
|
||||||
import collision.CollisionInfo;
|
import collision.CollisionInfo;
|
||||||
|
|
@ -120,7 +121,7 @@ class LandMine extends DtsObject {
|
||||||
this.setCollisionEnabled(false);
|
this.setCollisionEnabled(false);
|
||||||
|
|
||||||
// if (!this.level.rewinding)
|
// if (!this.level.rewinding)
|
||||||
// AudioManager.play(this.sounds[0]);
|
AudioManager.playSound(ResourceLoader.getAudio("data/sound/explode1.wav"));
|
||||||
this.level.particleManager.createEmitter(landMineParticle, landMineParticleData, this.getAbsPos().getPosition());
|
this.level.particleManager.createEmitter(landMineParticle, landMineParticleData, this.getAbsPos().getPosition());
|
||||||
this.level.particleManager.createEmitter(landMineSmokeParticle, landMineSmokeParticleData, this.getAbsPos().getPosition());
|
this.level.particleManager.createEmitter(landMineSmokeParticle, landMineSmokeParticleData, this.getAbsPos().getPosition());
|
||||||
this.level.particleManager.createEmitter(landMineSparksParticle, landMineSparkParticleData, this.getAbsPos().getPosition());
|
this.level.particleManager.createEmitter(landMineSparksParticle, landMineSparkParticleData, this.getAbsPos().getPosition());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.AudioManager;
|
||||||
|
import hxd.res.Sound;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import src.Util;
|
import src.Util;
|
||||||
|
|
@ -31,6 +33,7 @@ abstract class PowerUp extends DtsObject {
|
||||||
public var powerupParams:PowerupParams = new PowerupParams();
|
public var powerupParams:PowerupParams = new PowerupParams();
|
||||||
public var pickUpName:String;
|
public var pickUpName:String;
|
||||||
public var element:MissionElementItem;
|
public var element:MissionElementItem;
|
||||||
|
public var pickupSound:Sound;
|
||||||
|
|
||||||
public function new(element:MissionElementItem) {
|
public function new(element:MissionElementItem) {
|
||||||
super();
|
super();
|
||||||
|
|
@ -54,6 +57,10 @@ abstract class PowerUp extends DtsObject {
|
||||||
this.level.displayAlert('You picked up a ${this.pickUpName}!');
|
this.level.displayAlert('You picked up a ${this.pickUpName}!');
|
||||||
if (this.element.showhelponpickup == "1" && !this.autoUse)
|
if (this.element.showhelponpickup == "1" && !this.autoUse)
|
||||||
this.level.displayHelp('Press <func:bind mousefire> to use the ${this.pickUpName}!');
|
this.level.displayHelp('Press <func:bind mousefire> to use the ${this.pickUpName}!');
|
||||||
|
|
||||||
|
if (pickupSound != null) {
|
||||||
|
AudioManager.playSound(pickupSound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
@ -12,6 +13,7 @@ class ShockAbsorber extends PowerUp {
|
||||||
this.isTSStatic = false;
|
this.isTSStatic = false;
|
||||||
this.identifier = "ShockAbsorber";
|
this.identifier = "ShockAbsorber";
|
||||||
this.pickUpName = "Shock Absorber PowerUp";
|
this.pickUpName = "Shock Absorber PowerUp";
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/pushockabsorbervoice.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
@ -12,6 +13,7 @@ class SuperBounce extends PowerUp {
|
||||||
this.isTSStatic = false;
|
this.isTSStatic = false;
|
||||||
this.identifier = "SuperBounce";
|
this.identifier = "SuperBounce";
|
||||||
this.pickUpName = "Super Bounce PowerUp";
|
this.pickUpName = "Super Bounce PowerUp";
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/pusuperbouncevoice.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
import src.ParticleSystem.ParticleData;
|
import src.ParticleSystem.ParticleData;
|
||||||
import h3d.Vector;
|
import h3d.Vector;
|
||||||
|
import src.AudioManager;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
||||||
final superJumpParticleOptions:src.ParticleSystem.ParticleEmitterOptions = {
|
final superJumpParticleOptions:src.ParticleSystem.ParticleEmitterOptions = {
|
||||||
|
|
@ -43,6 +45,7 @@ class SuperJump extends PowerUp {
|
||||||
sjEmitterParticleData = new ParticleData();
|
sjEmitterParticleData = new ParticleData();
|
||||||
sjEmitterParticleData.identifier = "superJumpParticle";
|
sjEmitterParticleData.identifier = "superJumpParticle";
|
||||||
sjEmitterParticleData.texture = ResourceLoader.getTexture("data/particles/twirl.png");
|
sjEmitterParticleData.texture = ResourceLoader.getTexture("data/particles/twirl.png");
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/pusuperjumpvoice.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
@ -55,7 +58,7 @@ class SuperJump extends PowerUp {
|
||||||
this.level.particleManager.createEmitter(superJumpParticleOptions, this.sjEmitterParticleData, null, () -> marble.getAbsPos().getPosition());
|
this.level.particleManager.createEmitter(superJumpParticleOptions, this.sjEmitterParticleData, null, () -> marble.getAbsPos().getPosition());
|
||||||
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity
|
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity
|
||||||
// if (!this.level.rewinding)
|
// if (!this.level.rewinding)
|
||||||
// AudioManager.play(this.sounds[1]);
|
AudioManager.playSound(ResourceLoader.getAudio("data/sound/dosuperjump.wav"));
|
||||||
// this.level.particles.createEmitter(superJumpParticleOptions, null, () => Util.vecOimoToThree(marble.body.getPosition()));
|
// this.level.particles.createEmitter(superJumpParticleOptions, null, () => Util.vecOimoToThree(marble.body.getPosition()));
|
||||||
this.level.deselectPowerUp();
|
this.level.deselectPowerUp();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import src.ParticleSystem.ParticleEmitterOptions;
|
||||||
import h3d.Quat;
|
import h3d.Quat;
|
||||||
import h3d.Vector;
|
import h3d.Vector;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
import src.AudioManager;
|
||||||
|
|
||||||
final superSpeedParticleOptions:ParticleEmitterOptions = {
|
final superSpeedParticleOptions:ParticleEmitterOptions = {
|
||||||
ejectionPeriod: 5,
|
ejectionPeriod: 5,
|
||||||
|
|
@ -50,6 +51,7 @@ class SuperSpeed extends PowerUp {
|
||||||
ssEmitterParticleData = new ParticleData();
|
ssEmitterParticleData = new ParticleData();
|
||||||
ssEmitterParticleData.identifier = "superSpeedParticle";
|
ssEmitterParticleData.identifier = "superSpeedParticle";
|
||||||
ssEmitterParticleData.texture = ResourceLoader.getTexture("data/particles/spark.png");
|
ssEmitterParticleData.texture = ResourceLoader.getTexture("data/particles/spark.png");
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/pusuperspeedvoice.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
@ -74,7 +76,7 @@ class SuperSpeed extends PowerUp {
|
||||||
// marble.body.addLinearVelocity(Util.vecThreeToOimo(movementVector).scale(24.7)); // Whirligig's determined value
|
// marble.body.addLinearVelocity(Util.vecThreeToOimo(movementVector).scale(24.7)); // Whirligig's determined value
|
||||||
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity
|
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity
|
||||||
// if (!this.level.rewinding)
|
// if (!this.level.rewinding)
|
||||||
// AudioManager.play(this.sounds[1]);
|
AudioManager.playSound(ResourceLoader.getAudio("data/sound/dosuperspeed.wav"));
|
||||||
this.level.particleManager.createEmitter(superSpeedParticleOptions, this.ssEmitterParticleData, null, () -> marble.getAbsPos().getPosition());
|
this.level.particleManager.createEmitter(superSpeedParticleOptions, this.ssEmitterParticleData, null, () -> marble.getAbsPos().getPosition());
|
||||||
this.level.deselectPowerUp();
|
this.level.deselectPowerUp();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import mis.MisParser;
|
import mis.MisParser;
|
||||||
|
|
@ -22,6 +23,7 @@ class TimeTravel extends PowerUp {
|
||||||
this.cooldownDuration = 1e8;
|
this.cooldownDuration = 1e8;
|
||||||
this.useInstancing = true;
|
this.useInstancing = true;
|
||||||
this.autoUse = true;
|
this.autoUse = true;
|
||||||
|
this.pickupSound = ResourceLoader.getAudio("data/sound/putimetravelvoice.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp():Bool {
|
public function pickUp():Bool {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import src.Util;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
import h3d.Vector;
|
import h3d.Vector;
|
||||||
import src.ForceObject;
|
import src.ForceObject;
|
||||||
|
import src.ResourceLoader;
|
||||||
|
import src.AudioManager;
|
||||||
|
|
||||||
class Trapdoor extends DtsObject {
|
class Trapdoor extends DtsObject {
|
||||||
var lastContactTime = -1e8;
|
var lastContactTime = -1e8;
|
||||||
|
|
@ -37,7 +39,7 @@ class Trapdoor extends DtsObject {
|
||||||
direction = -1;
|
direction = -1;
|
||||||
if (direction != 0 && direction != this.lastDirection) {
|
if (direction != 0 && direction != this.lastDirection) {
|
||||||
// If the direction has changed, play the sound
|
// If the direction has changed, play the sound
|
||||||
// AudioManager.play(this.sounds[0], 1, AudioManager.soundGain, this.worldPosition);
|
// AudioManager.playSound(this.sounds[0], 1, AudioManager.soundGain, this.worldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastCompletion = currentCompletion;
|
this.lastCompletion = currentCompletion;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package triggers;
|
package triggers;
|
||||||
|
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
|
import src.ResourceLoader;
|
||||||
|
import src.AudioManager;
|
||||||
|
|
||||||
class HelpTrigger extends Trigger {
|
class HelpTrigger extends Trigger {
|
||||||
override function onMarbleEnter(timeState:TimeState) {
|
override function onMarbleEnter(timeState:TimeState) {
|
||||||
// AudioManager.play('infotutorial.wav');
|
AudioManager.playSound(ResourceLoader.getAudio('data/sound/infotutorial.wav'));
|
||||||
this.level.displayHelp(this.element.text);
|
this.level.displayHelp(this.element.text);
|
||||||
// this.level.replay.recordMarbleEnter(this);
|
// this.level.replay.recordMarbleEnter(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue