Day 43

Today was a shortened block and I couldn't do as much work today. Today I wanted to add multiple values to one variable but I couldn't figure out how to. So i googled it and I found something called an array. An array is a way that you can add multiple values to one variable. The syntax kinda looks like this

array[2] = 0;
array[1] = 0;
array[0] = 0;


This is defining the array variable with a certain number or value. You can then pull out that certain value of that number like this.

Switch(array){

case 1
 {
//code here
 }
}

case 1 pull out the value from array[1] case 2 pulls out array[2] etc. if you know what i mean.
I used this for the tutorial:
http://docs.yoyogames.com/source/dadiospice/002_reference/001_gml%20language%20overview/401_06_arrays.html

I wanted to add all my sounds into one variable called audio. So that when I press the mute button i can use audio_sound_gain(audio,0,0) so that the volume goes to 0.

Tomorrow I will find a way to work with arrays in my game and mute the sound.

No comments:

Post a Comment