• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML [SOLVED] Script not making sound

A

Anti-Icarus

Guest
I'm working on a Tic-Tac-Toe game based on a chapter of The Game Maker's Apprentice. It's in the early stages in development and I've encountered a problem: there is no clicking sound for when I click on the designated game field within a 640x480 room.

Tic-Tac-Toe screenshot.png

Following the instructions of The Game Maker's Apprentice, I created an object utilizing scripts to define the play field.

Tic-Tac-Toe version 2 error analysis.png

So far, the scripts within the events of obj_field are working as evident in the screenshot below:

Tic-Tac-Toe version 2 early gameplay screenshot.png

The only real problem I'm having so far is that there is no clicking sound for whenever I click in the designated play field. I've written the script (scr_field_click) from the textbook, so as it stands, it goes like this:

Code:
{
    var i, j;
    //Find the position that is clicked
    i = floor((mouse_x - 208) / 140);
    j = floor((mouse_y - 32) / 140);
    //Check whether it exists and is empty
    if (i < 0 || i > 2 || j < 0 || j > 2) exit;
    if (field[i, j] != 0) exit;
    //Set the stone
    field[i, j] = 1;
    sound_play(snd_place);
}
The problem I'm referring to is in the bottom part of the script when I click on the field to set the stone. While the script as it is would work exactly like it was supposed to in the older versions of GameMaker, that is not the case with GameMaker: Studio as it is just not playing any sound at all when I click on the designated field. Now how can I get it to actually play the clicking sound? Would changing the Global Mouse, Left Button event into another event work? Or would I have to alter the script a little bit so that the sound would be played?
 
Top