Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Totally stumped here.

Author
Message
Sunflash
19
Years of Service
User Offline
Joined: 28th Jun 2005
Location: Seattle, Wa
Posted: 19th Feb 2006 01:32
Hey, it's me... again

I have a slider like thing (image attached), when you click the left arrow button, a circle slides left 50 pixels click the right arrow button, the same circle slides right 50 pixels. Well, here's the problem. If the person holds down the left mouse button, it slides really fast. What I want to have happen is:

If the user clicks the right button, the circle slides right 50 pixels, but then the user has to click AGAIN before it slides another fifty pixels. The same goes for when the left arrow button is clicked.

I used the same idea for playing a click sound when the user clicks the left mouse button. If this happenedm, a sound would play. But if the user held the mouse down, the sound would repeat really fast, and that sounded terrible. Well, in the end, I got the mouse sound thing working, but for some reason I can't get the slider issue solved. Here's the code I'm useing:



Sinc this code was based on the mouse clicking code, I'll post it here. Again, this code DOES work. So if you think you have found a bug with the code above, check this one to see if the same bug should have applied to it. If so, then it most likly isn't a bug



Hope someone gets this figured out!
Thanks for the help,
-Sunflash T. Mace

When FPSC develops enough, lets make a Redwall game!

Attachments

Login to view attachments
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 19th Feb 2006 03:07
Here is what I do(untested):



Sunflash
19
Years of Service
User Offline
Joined: 28th Jun 2005
Location: Seattle, Wa
Posted: 19th Feb 2006 03:12
I tried something like that awhile ago, I try it again though.

When FPSC develops enough, lets make a Redwall game!

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Feb 2006 13:04
I do.....


Repeat
Until Mouseclick() = 0


After a click. It's OK for menus and stuff. Can't be used during movement routines because it stops the program.

Sunflash
19
Years of Service
User Offline
Joined: 28th Jun 2005
Location: Seattle, Wa
Posted: 22nd Feb 2006 01:55
Lol, I found the problem. It wasn't working because at the start of the function the variable mousedown was defined at the start of the function. So everytime the function was run, the variable was reset, making it so it always detected that the mouse was never down.
To fix it, I just made the variable global, and defined and created it at the start of the program. Thanks for the help guys
-Sunflash

When FPSC develops enough, lets make a Redwall game!

Login to post a reply

Server time is: 2025-05-23 15:02:10
Your offset time is: 2025-05-23 15:02:10