Lately I've started making a game, where you can have a number of players from 2-8. To keep the nice interface, I decided to make a slider which you can pull around. I didn't get too far... I just tried to make it stop at a point (the ends of the slides) when the mouse went too far. Somehow I didn't have success. I have a variable (slidemarkvar) which is set to 2 at the mouse-button-down event, and is set back to 1 at the mouse-button-up event. On the Draw event of that slider thingy I have the following code:
- Code: Select all
if(slidemarkvar==2)
{
FollowMouse("slidermark", X_AXIS);
if(xmouse > 45)
{
slidermark.x=45;
}
if(xmouse < -130)
{
slidermark.x= -130;
}
}
But here's the problem: When I hold the mouse button down, it stays in one place (somewhere around 40), when I release the mouse button, it follows the mouse on the x axis as it should, but it doesn't stop at 45 and -130! What's the problem? Can anyone help, please!