Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Rotate Key


Helladen
 Share

Recommended Posts

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

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. :P
So whatever a few lines of code isn't going to kill anyone. :O
Link to comment
Share on other sites

  • 2 months later...
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

@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. :P
Link to comment
Share on other sites

@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. :P

Didn't mean to make you angry
![](http://farm4.static.flickr.com/3226/3064273457_1a725335f4.jpg)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...