I can hear bad guys shooting from across the level!

Game Editor comments and discussion.

I can hear bad guys shooting from across the level!

Postby d-soldier » Sat Apr 21, 2007 3:46 pm

.. Been doing some beta testing of my game, and I ran through it without killing the baddies (just in case someone might do that) and sure enough, as I'm in a totally different section of the map I can still hear them shooting at me (audio only)... Other then the "destory if off screen" (their paths cause them to go off screen frequently) can anyone think of a way to silence these guys when they are x distance from player?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sat Apr 21, 2007 4:59 pm

make an actor variable called sound,
and use this
Code: Select all
if(distance(x, 0, player.x, 0) > 100)sound = 0;
else
{
   sound = 1;
}

and when that play the sound use:
Code: Select all
PlaySound2("data/your_sound.wav", sound, 1, 0.000000);

:)
I hope that helps.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

....

Postby d-soldier » Sat Apr 21, 2007 6:17 pm

So I made the actor variable called sound... (not very advanced when it comes to variables mind you)... so where do I put the:
if(distance(x, 0, player.x, 0) > 100)sound = 0;
else
{
sound = 1;
}
????
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sat Apr 21, 2007 6:17 pm

draw actor event for that badies :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

ugg

Postby d-soldier » Sat Apr 21, 2007 7:13 pm

... doesnt seem to work... the laser(actor) is creates the sound upon it's creation, so I put the code-
------
if(distance(x, 0, player.x, 0) > 100)sound = 0;
else
{
sound = 1;
}
-----
in it's creation script (even tried draw actor script too) and removed the original create actor/play sound function and replaced with create actor/script -
-----
PlaySound2("data/your_sound.wav", sound, 1, 0.000000);
-----
And now I hear nothing... adjusted the x distance in the script, and even moved my "not drawn at startup" laser actor close to the action (just to be sure)... nothing... Any ideas? (and I did adjust the "player" actor name in the code to fit my game, btw)
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sat Apr 21, 2007 9:26 pm

hmmm,
if it is for when the lazer is created then just use for the whole thing,
Code: Select all
if(distance(x, 0, y, 0) < 200)PlaySound2("data/your_sound.wav", sound, 1, 0.000000);

and you know you must change the data/your_sound to the exact sound stuff. :)
(click on variables/functions and the menu will pop up and click on playsound,
select the sound volume and location ect.
:) and you know what to do next :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Ha!

Postby d-soldier » Sat Apr 21, 2007 9:47 pm

... Nothing seemed to work until I changed the sound variable from actor to global, now it works perfectly! Thanks again - thats twice today!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sat Apr 21, 2007 9:47 pm

xD
:D
you're welcome, any time! :)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron