Move character

Blitz3D Forums/Blitz3D Beginners Area/Move character

fox95871(Posted 2008) [#1]
(Link removed. Please see post 11.)

Could someone please help me fix this? I want to it be so when you hold down the mouse button and drag, the character moves, and then if you do it again, the character moves some more. The way it is now, the character just keeps going back to the mouse's relative position on the screen instead of having a variable that changes each time. I know it's probably a simple fix but I just can't seem to figure it out. Most of the code relating to all this is at the very end of the .bb, and I've put some extra notes there too. Thanks.

I really appreciate this forum. I don't know what I'd do without some kind of a backup plan. Most of the stuff I can figure out on my own, but whenever I run into a wall it's great to have this place to turn to.

Last edited 2010


Warner(Posted 2008) [#2]
I can't run Blitz3d on this machine here, but usually I use code similair to this for mouse dragging:



fox95871(Posted 2008) [#3]
Okay, thanks. Looking forward to trying that when I get home.


fox95871(Posted 2008) [#4]
That worked perfectly, thank you very much.


fox95871(Posted 2008) [#5]
(Link removed. Please see post 11.)

Well, it was perfect. For some reason the new code only works on the first part of the function, which moves the character along the ground plane. When you try to use the other move modes, they just have the same bug as before, resetting the character's position each time you start a new mouse drag. One thing I noticed though is that each mode actually works just fine as long as it's first in the function, but I don't know why they won't all work together. I was thinking maybe I should break them up into different functions, but I'd really rather not do that for the purpose of keeping my menu code from getting even more complicated than it already is. Is there some way I can get them to all work in the same function? Hope you can help again. I've included a text file of the code this time and an exe instead of just the bb.

Last edited 2010


GIB3D(Posted 2008) [#6]
Hey I know how to fix it, you have to flush the mouse input (I made the function FlushInput() at the verrrrry bottom) to get rid of the speed... I changed your mouse hitting and downing into a Select thing so its easier to read, but I did leave your other way just incase you like it better (I didnt use the FlushInput in your other MouseHittings and Downings...




Knight #51(Posted 2008) [#7]
hmmmmmmm.......


GIB3D(Posted 2008) [#8]
Something wrong?


fox95871(Posted 2008) [#9]
Oh wow, you actually worked on my code for me? Thanks! Can't wait to try it when I get home.


Knight #51(Posted 2008) [#10]
No nothing's wrong.....just pretty complicated.


fox95871(Posted 2008) [#11]
(Moving files to a new host. This will be a link soon)

I'm so glad you got it to work, I can't believe it. I'm gonna run with it, even though Select/Case isn't really my style. But just out of curiosity, how could I make your function work with my previous If/EndIf code? I tried putting it in what I thought would be comparatively similar places, but it didn't work. Anyway, don't worry about it. Thanks so much for fixing my code. The above link is the now working version for anyone who needs it.

Last edited 2010