Jumping instead of Walking :(

Blitz3D Forums/Blitz3D Programming/Jumping instead of Walking :(

matthews_30(Posted 2006) [#1]
i am trying to modify a code that works with keyboard to make it work with the mouse. The problem is when i click with the mouse it jumps directly to the new Y position (WorldY) instead of walking to get the new position.

the original code is the following:

        ; Going Down
        Case 2
             OldY = WorldY
             WorldY = WorldY + Distance 
             If WorldY > Map_Height * TileHeight - TileHeight
                WorldY = Map_Height * TileHeight - TileHeight
             EndIf


is there an example of replacing arrow keys with the mouse + left click to walk?

i was all week end trying to make it work, but it didn't :'(


matthews_30(Posted 2006) [#2]
that code is for going down only.

i need an exmaple so i can work on the rest of code.


jfk EO-11110(Posted 2006) [#3]
maybe something's wrong with the value of "distance", try something like:

WorldY = WorldY + (Distance / 10.0)

make sure distance is a float# variable.


Riddle(Posted 2006) [#4]
I think your trying to setup the movement like Diablo, Diablo2 (mouse + left click to walk). Where you click on a spot and you walk over to that spot.

If this is the case then you need to do the following:
- left click on a spot creates a marker on that spot (can be anything - I use invisible spheres)

- point your entity to that marker

- move your entity forward till it touches the marker (or gets in a certain distance of it - up to you) **This should be done in your main loop so that your entity only moves a little bit at a time - so it looks like walking**

- remove the marker

Try that out and see how it works for you.

If your having problems I can post some sample code to help.