volume bar

For questions about using Classic.

Post » Thu Jul 26, 2012 9:47 am

how can i make a volume bar?
i mean i want to have in my game in options slider, where i can control sound volume
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Thu Jul 26, 2012 1:20 pm

Depends what plugin you're using.

In XAudio2 I used this forumla to set master volume:

-40 + ([SOUND VOLUME PERCENTAGE] / 100) * 40)
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Jul 26, 2012 1:53 pm

thanks,
what i need to know is how to make control bar.
i mean some object (line) with some cursor - and i want this cursor slide from left to right or from right to left and volume will change.
my biggest problem is that i dont know how to make an object (cursor), which i will drag only in specific location (which behavior?, how to setup it?).
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Thu Jul 26, 2012 4:12 pm

Just build one with graphics and events. Here's an example to help you get started: slider.cap
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jul 26, 2012 4:53 pm

thanks, this is great!
i looked at it. what exactly is "clamp" ?
there are some many things like this in scirra and i dont know how to use them...
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Thu Jul 26, 2012 8:00 pm

I recommend reading the wiki. This is the page explaining the system expressions: scroll down to "Math"

clamp is just one of many functions that are common to most programming languages. The best practice is to read about them, look for descriptions/examples on the net and try for yourself. Then you are aware of them in case you need them.
Math functions you will almost always need somewhere somehow:
sin(), cos(), min(), max(), clamp(), ceil(), floor(), round(), abs(), lerp()
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Aug 04, 2012 4:49 pm

thanks, it looks really great.
but still there are many many things i dont understant (i am not programmer).
so if there is for example "lerp"- linear interpolation etc... but for me it is very hard to understand what for it really is and how can i use it...
do you have some link for beginners? i am really bad with it and i really want to learn how to use construct as best as possible (and not only construct, but i want to understand game programming generally).
or maybe some good book to learn it?
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Sun Aug 05, 2012 4:24 am

I'm sorry, I can't propose any beginner's guide. I never used one. When I started learning those things, there wasn't any literature for beginners. Normally I suggest to just use those functions (expressions in CC) and learn from analyzing the result (that's the way I did it way back in the early 80s^^)
However, if you can learn better from being tought, there might be some help. I remember @lucid once posted a link to some math site, that made extensive explanations.

And although I'm no friend of such advices, in this case google might help too ;)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Aug 06, 2012 11:59 am

ok tulamide :)
i also learn this way now, but it is soo slow :)
thanks ;)
B
4
S
2
G
1
Posts: 143
Reputation: 1,211


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests