Results 1 to 3 of 3

Thread: player wont move....

Threaded View

  1. #1

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Exclamation player wont move....

    player wont move on the X axis can anyone help me

    VB Code:
    1. Public Function Move(ByVal oMap As CMap, ByVal cDirection As DirectionConstants) As Boolean
    2.     If Direction <> cDirection Then
    3.         Let Direction = cDirection
    4.         Exit Function
    5.     End If
    6.    
    7.     If X <= 0 And Direction = DirectionLeft Then
    8.         Let X = 0
    9.         Exit Function
    10.     ElseIf X >= oMap.Width And Direction = DirectionRight Then
    11.         Let X = oMap.Width
    12.         Exit Function
    13.     End If
    14.    
    15.     If Y <= 0 And Direction = DirectionUp Then
    16.         Let Y = 0
    17.         Exit Function
    18.     ElseIf Y >= oMap.Height And Direction = DirectionDown Then
    19.         Let Y = oMap.Height
    20.         Exit Function
    21.     End If
    22.    
    23.     Select Case cDirection
    24.         Case DirectionDown
    25.             If Not oMap.Blocked(X, Y + 1) And Y + 1 >= 0 Then
    26.                 Let Move = True
    27.                 Let Y = Y + 1
    28.             End If
    29.             Exit Function
    30.            
    31.         Case DirectionLeft
    32.             If Not oMap.Blocked(X - 1, Y) And X - 1 >= oMap.Width Then
    33.                 Let Move = True
    34.                 Let X = X - 1
    35.             End If
    36.             Exit Function
    37.            
    38.         Case DirectionRight
    39.             If Not oMap.Blocked(X + 1, Y) And X + 1 >= oMap.Width Then
    40.                 Let Move = True
    41.                 Let X = X + 1
    42.             End If
    43.             Exit Function
    44.            
    45.         Case DirectionUp
    46.             If Not oMap.Blocked(X, Y - 1) And Y - 1 >= 0 Then
    47.                 Let Move = True
    48.                 Let Y = Y - 1
    49.             End If
    50.             Exit Function
    51.     End Select
    52. End Function
    Last edited by nareth; Jan 18th, 2005 at 11:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width