Volume

Non-platform specific questions.

Volume

Postby summer_goth » Thu Feb 14, 2008 9:03 am

Hi there,

In the settings I've got it so that one can set the volume louder and softer.

However it just never seems to set the volume to 0. I know I'm doing something wrong, but I'm not sure what.

This is the code for a mouse up click event:

Code: Select all
if (musicvol != 0)
{
  musicvol -= 0.2;
}


The volume starts at 1. So eventually it should get to 0, but it doesn't. Is musicvol being rounded down maybe? Eh, I don't know.

Thanks for the help.
User avatar
summer_goth
 
Posts: 153
Joined: Fri Jun 22, 2007 8:07 am
Location: South Africa
Score: 5 Give a positive score

Re: Volume

Postby Bee-Ant » Thu Feb 14, 2008 10:12 am

Yeah...making musicvol=0; wont make your music to be silent...btw,if you dont wanna use music...why dont you just set your speaker volume?Oh...so,you wanna make something like volume effect?
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Volume

Postby summer_goth » Thu Feb 14, 2008 4:19 pm

Nope, as far as I can see setting musicvol to zero will make it mute. However with the code I showed it doesn't seem to reach zero.

I can't just set my speaker volume. It's a game that's going to be released for Windows Mobile devices. It has settings and one of those settings is to set the volume. If I played a game on Windows Mobile and it didn't give me options to set the volume I would be rather irritated.

Does anyone know what I'm doing wrong?

Thanks for the help.
User avatar
summer_goth
 
Posts: 153
Joined: Fri Jun 22, 2007 8:07 am
Location: South Africa
Score: 5 Give a positive score

Re: Volume

Postby Bee-Ant » Thu Feb 14, 2008 4:30 pm

yeah...changing musicvol to 0 doesnt make your music to be silent
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Volume

Postby makslane » Thu Feb 14, 2008 7:45 pm

summer_goth wrote:In the settings I've got it so that one can set the volume louder and softer.
However it just never seems to set the volume to 0.


It's a precision problem of the script engine.
Put this code after yours:

Code: Select all
if(musicvol < 0.0) musicvol = 0.0;
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Volume

Postby summer_goth » Thu Feb 14, 2008 7:48 pm

Thank you very much Makslane.
User avatar
summer_goth
 
Posts: 153
Joined: Fri Jun 22, 2007 8:07 am
Location: South Africa
Score: 5 Give a positive score

Re: Volume

Postby Bee-Ant » Fri Feb 15, 2008 11:37 am

What is the difference between 0 and 0.0 anyway??? :lol: :lol: :lol:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Volume

Postby makslane » Fri Feb 15, 2008 6:26 pm

0 is a integer, 0.0 is a float.
To not make errors when the formula have a float variable, like musicvol, I like to use float numbers.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Volume

Postby edh » Fri Feb 15, 2008 6:53 pm

@B-A: The difference is the precision! :lol:
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Volume

Postby Bee-Ant » Sat Feb 16, 2008 1:56 am

:wink: :lol:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Volume

Postby Game A Gogo » Sat Feb 16, 2008 6:19 am

this needs to be quoted... seriously, sounds epic!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Volume

Postby Bee-Ant » Sun Feb 17, 2008 3:46 am

:roll:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron