Helladen Posted August 16, 2010 Author Share Posted August 16, 2010 I've posted something like this before, but it is a lot more simple. Basically this allows a user to rotate their direction using the End key.The user will rotate clockwise.**Client:****In frmMainGame** ->**In Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)** ->**Under Select Case KeyCode paste this code**```Case vbKeyEnd If Player(MyIndex).Moving = NO Then If GetPlayerDir(MyIndex) = 0 Then Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 3) ElseIf GetPlayerDir(MyIndex) = 1 Then Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1) ElseIf GetPlayerDir(MyIndex) = 2 Then Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) - 2) ElseIf GetPlayerDir(MyIndex) = 3 Then Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) - 2) End If Call SendPlayerDir End If``` Link to comment Share on other sites More sharing options...
Sir Cid Posted August 23, 2010 Share Posted August 23, 2010 Thumbs up, Helladen! It's simple and it works. : ) Link to comment Share on other sites More sharing options...
Tyr Posted August 23, 2010 Share Posted August 23, 2010 ```If GetPlayerDir(MyIndex) = 3 Then Call SetPlayerDir(MyIndex, 0)Else Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1)End If``` Link to comment Share on other sites More sharing options...
Sir Cid Posted August 24, 2010 Share Posted August 24, 2010 @Tyr:> ```> If GetPlayerDir(MyIndex) = 3 Then> Call SetPlayerDir(MyIndex, 0)> Else> Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1)> End If> ```6 more or less lines, doesn't really bother. Link to comment Share on other sites More sharing options...
Robin Posted August 24, 2010 Share Posted August 24, 2010 @Tyr:> ```> If GetPlayerDir(MyIndex) = 3 Then> Call SetPlayerDir(MyIndex, 0)> Else> Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1)> End If> ```Already posted that. Doesn't work due to the way the directions are set up. Link to comment Share on other sites More sharing options...
Helladen Posted August 24, 2010 Author Share Posted August 24, 2010 I tried changing the way there setup in the enumerations, but It screwed something else up. Pretty sure the code uses it more than once, and you would have to fix all the times the direction is done by adding one or subtracting one etc. It's not worth changing in my opinion for a direction key. :PSo whatever a few lines of code isn't going to kill anyone. :O Link to comment Share on other sites More sharing options...
Robin Posted August 24, 2010 Share Posted August 24, 2010 It's certainly worth changing. Not for a rotating key, but for a better way of handing directions. Link to comment Share on other sites More sharing options...
Helladen Posted October 25, 2010 Author Share Posted October 25, 2010 Updated. Added Send so it effects clients not just server. Link to comment Share on other sites More sharing options...
mrmiguu Posted October 25, 2010 Share Posted October 25, 2010 1 line ;D```If GetPlayerDir(MyIndex) = 3 Then Call SetPlayerDir(MyIndex, 0) Else Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1)```I think Robin is talking about like arrow key taps to change the player's dir, then hold down to move in that dir. Link to comment Share on other sites More sharing options...
Robin Posted October 25, 2010 Share Posted October 25, 2010 @Helladen:> Updated. Added Send so it effects clients not just server.Affects* Link to comment Share on other sites More sharing options...
Helladen Posted October 25, 2010 Author Share Posted October 25, 2010 @Miguu:> 1 line ;D> ```> If GetPlayerDir(MyIndex) = 3 Then Call SetPlayerDir(MyIndex, 0) Else Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1)> > ```> I think Robin is talking about like arrow key taps to change the player's dir, then hold down to move in that dir.No that is incorrect.1\. The direction enumerations are in a non-clockwise order, so the turning would look random.2\. It does not send the data to the other clients.Also I'm aware of making it one line. I posted about a 30-50 lines of code revision and people said it wasn't worth it. So hardly says that a couple lines is worth it either… On my WN copy I have where WASD enables the arrow keys to turn directions, but they are off if you are using arrow movement. I am aware of that too. End method works for both though.@RobinI always get those two words mixed up rofl.Robin corrects language for once. :P Link to comment Share on other sites More sharing options...
Robin Posted October 25, 2010 Share Posted October 25, 2010 In their most common forms, affect is the verb.My boot _affected_ the Fox.Effect is the result.The _effect_ was painful. Link to comment Share on other sites More sharing options...
Helladen Posted October 25, 2010 Author Share Posted October 25, 2010 Ah I see. :)English lesson of the day. Link to comment Share on other sites More sharing options...
mrmiguu Posted October 25, 2010 Share Posted October 25, 2010 @Helladen:> @Miguu:> > > 1 line ;D> > ```> > If GetPlayerDir(MyIndex) = 3 Then Call SetPlayerDir(MyIndex, 0) Else Call SetPlayerDir(MyIndex, GetPlayerDir(MyIndex) + 1)> > > > ```> > I think Robin is talking about like arrow key taps to change the player's dir, then hold down to move in that dir.> > No that is incorrect.> 1\. The direction enumerations are in a non-clockwise order, so the turning would look random.> 2\. It does not send the data to the other clients.> > Also I'm aware of making it one line. I posted about a 30-50 lines of code revision and people said it wasn't worth it. So hardly says that a couple lines is worth it either… On my WN copy I have where WASD enables the arrow keys to turn directions, but they are off if you are using arrow movement. I am aware of that too. End method works for both though.> > @Robin> I always get those two words mixed up rofl.> > Robin corrects language for once. :PDidn't mean to make you angry![](http://farm4.static.flickr.com/3226/3064273457_1a725335f4.jpg) Link to comment Share on other sites More sharing options...
Helladen Posted October 26, 2010 Author Share Posted October 26, 2010 You didn't. xD I appreciate you trying to help. 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