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 Professional Discussion / Pick screen, pick object, positioning object and mouse. Just cannot seem to get this right.

Author
Message
BCIT
16
Years of Service
User Offline
Joined: 26th Jan 2010
Location:
Posted: 26th Apr 2010 20:02
I am having a difficult time with the code below. Whenever I make a new object, I want the object to fall where the mouse pointer is; likewise, whenever I select an object with the mouse, I want to move the object from where it was. When ever I try to do either, the object seems to "jump start" from a random location.

Howzer
22
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Ontario, Canada
Posted: 27th Apr 2010 04:00 Edited at: 27th Apr 2010 04:10
Well, I clearly read your question wrong initially. Let me come up with something else for you

**Edit**

Add this right before the end of your loop:

mx# = mousemovex()
my# = mousemovey()

That will ensure that you're checking the mouse movement each loop. The problem that you were having is that the move was being moved, but you weren't clearing those values.
BCIT
16
Years of Service
User Offline
Joined: 26th Jan 2010
Location:
Posted: 27th Apr 2010 15:53
What is mx# since there is no mx# in my code? Is that x#? If that is the case I added x# = mousemovex() and y# = mousemovey() just before the end of the loop and the result is that the object will simply not move along x or y.
Howzer
22
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Ontario, Canada
Posted: 28th Apr 2010 00:05
It was just a variable that I made up to clear out the mousemove values. It's not to be used anywhere else in your code. Once those lines are added in, it works nice.
BCIT
16
Years of Service
User Offline
Joined: 26th Jan 2010
Location:
Posted: 28th Apr 2010 17:48
Thanks Howzer, but now when I left click on a cube in order to move it, the cube jumps to the middle of the screen.

Login to post a reply

Server time is: 2026-07-26 04:27:39
Your offset time is: 2026-07-26 04:27:39