• 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!

Change a variable by pressing a jpg/png

R

Ron J

Guest
I'm new to programming and am currently using GameMaker Studio 2 Drag And Drop. I'm trying to perform a simple task but can't figure it out... I want to alternate between two audio tracks playing simultaneously by pressing a jpg/png (with mouse left). When the variable "CSwitch" is set to 0, the volume on Track A is set to 1 and Track B is set to 0 (so you can only hear Track A). When variable "CSwitch" is set to 1, Track A's volume is set to 0, and Track B is set to 1 (so you can only hear Track B). I have the volumes all working but can't figure out how to change the variable from 0 to 1 by pressing the jog with mouse Left. Thanks...
 

Roderick

Member
Get the top, bottom, left and right positions of your image (how you get them depends on how you're displaying the image). Then, when you click, check to see if the mouse x is greater than the left edge and less than the right edge, and the mouse y is greater than the top and less than the bottom.
 
Top