balliztik1 Posted August 19, 2007 Author Share Posted August 19, 2007 Alright, I decided to do a little work with a click-to-move system. I haven't perfected it, as it requires quite a bit of editing to get it to do exactly what I wanted, but it does allow a player to move in the direction that you click.It's easy to add. Find _sub picUber_MouseDown_ in _frmMirage_. Add this to the bottom of it:```x = x \ 32y = y \ 32px = Player(MyIndex).xpy = Player(MyIndex).yIf px = x Then If py = y Then Exit Sub End If d = 0 If py < y Then d = d + 1 End IfElse m = (py - y) / (px - x) If Abs(m) >= 1 Then d = 0 Else d = 2 End If If d = 2 And px < x Or d = 0 And py < y Then d = d + 1 End IfEnd IfSelect Case d Case 0 DirUp = True DirDown = False DirLeft = False DirRight = False Case 1 DirUp = False DirDown = True DirLeft = False DirRight = False Case 2 DirUp = False DirDown = False DirLeft = True DirRight = False Case 3 DirUp = False DirDown = False DirLeft = False DirRight = TrueEnd SelectCall CheckMovement```Now, you'll just have to add a couple _Exit Sub_s. Change these two chunks of code:``` If (Button = 1 Or Button = 2) And InEditor = True Then 'Call AddText("Clicked xcalc" & (x + xcalc) & " ycalc" & (y + ycalc), BrightRed) Call EditorMouseDown(Button, Shift, Int((x + (xcalc))), Int((y + (ycalc)))) End If If (Button = 1 Or Button = 2) And InHouseEditor = True Then 'Call AddText("Clicked xcalc" & (x + xcalc) & " ycalc" & (y + ycalc), BrightRed) Call HouseEditorMouseDown(Button, Shift, Int((x + (xcalc))), Int((y + (ycalc)))) 'Call HouseEditorMouseDown(Button, Shift, (x + (NewPlayerX * PIC_X)), ycalc) End If```to:``` If (Button = 1 Or Button = 2) And InEditor = True Then 'Call AddText("Clicked xcalc" & (x + xcalc) & " ycalc" & (y + ycalc), BrightRed) Call EditorMouseDown(Button, Shift, Int((x + (xcalc))), Int((y + (ycalc)))) Exit Sub End If If (Button = 1 Or Button = 2) And InHouseEditor = True Then 'Call AddText("Clicked xcalc" & (x + xcalc) & " ycalc" & (y + ycalc), BrightRed) Call HouseEditorMouseDown(Button, Shift, Int((x + (xcalc))), Int((y + (ycalc)))) 'Call HouseEditorMouseDown(Button, Shift, (x + (NewPlayerX * PIC_X)), ycalc) Exit Sub End If```Note: The code may be different depending on which version you use. This is straight from the EE1 source.Finally, just add the dims to the top of the sub (Thanks to ollievar for catching this):```Dim pxDim pyDim dDim m```And that's it. I hope that I'll be able to add where you can move to a set destination with one click soon. Until then, enjoy. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now