Print Page | Close Window

door tile

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=164
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: door tile
Posted By: Sync
Subject: door tile
Date Posted: 11 February 2006 at 3:12pm
This will make door tile that acts like a key tile surrounded by keyopen tiles

add to modtypes in server and client

Public Const TILE_TYPE_DOOR = 16


in modgamlogic playermove find

    Select Case Dir
        Case DIR_UP
             ' Check to make sure not outside of boundries
             If GetPlayerY(Index) > 0 Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then
            
                               Call SetPlayerY(Index, GetPlayerY(Index) - 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                         
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Up > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Up, GetPlayerX(Index), MAX_MAPY)
                     Moved = YES
                 End If
             End If
                    
        Case DIR_DOWN
             ' Check to make sure not outside of boundries
             If GetPlayerY(Index) < MAX_MAPY Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) + 1) = YES) Then

                               Call SetPlayerY(Index, GetPlayerY(Index) + 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
       
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Down > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Down, GetPlayerX(Index), 0)
                     Moved = YES
                 End If
             End If
       
        Case DIR_LEFT
             ' Check to make sure not outside of boundries
             If GetPlayerX(Index) > 0 Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) - 1, GetPlayerY(Index)) = YES) Then
                       
               
                Call SetPlayerX(Index, GetPlayerX(Index) + 1)

                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                    
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Left > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Left, MAX_MAPX, GetPlayerY(Index))
                     Moved = YES
                 End If
             End If
       
        Case DIR_RIGHT
             ' Check to make sure not outside of boundries
             If GetPlayerX(Index) < MAX_MAPX Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) + 1, GetPlayerY(Index)) = YES) Then
                          
                               Call SetPlayerX(Index, GetPlayerX(Index) + 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                     
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Right > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Right, 0, GetPlayerY(Index))
                     Moved = YES
                 End If
             End If
    End Select



and replace it with

    Select Case Dir
        Case DIR_UP
             ' Check to make sure not outside of boundries
             If GetPlayerY(Index) > 0 Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then
                           ' Check to see if the tile is a door and if it is check if its opened
                           If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_DOOR Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then
                               Call SetPlayerY(Index, GetPlayerY(Index) - 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                           End If
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Up > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Up, GetPlayerX(Index), MAX_MAPY)
                     Moved = YES
                 End If
             End If
                    
        Case DIR_DOWN
             ' Check to make sure not outside of boundries
             If GetPlayerY(Index) < MAX_MAPY Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) + 1) = YES) Then
                           ' Check to see if the tile is a door and if it is check if its opened
                           If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_DOOR Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) + 1) = YES) Then
                               Call SetPlayerY(Index, GetPlayerY(Index) + 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                           End If
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Down > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Down, GetPlayerX(Index), 0)
                     Moved = YES
                 End If
             End If
       
        Case DIR_LEFT
             ' Check to make sure not outside of boundries
             If GetPlayerX(Index) > 0 Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) - 1, GetPlayerY(Index)) = YES) Then
                           ' Check to see if the tile is a door and if it is check if its opened
                           If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index - x), GetPlayerY(Index)).Type <> TILE_TYPE_DOOR Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) - 1, GetPlayerY(Index) + 1) = YES) Then
                               Call SetPlayerX(Index, GetPlayerX(Index) - 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                           End If
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Left > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Left, MAX_MAPX, GetPlayerY(Index))
                     Moved = YES
                 End If
             End If
       
        Case DIR_RIGHT
             ' Check to make sure not outside of boundries
             If GetPlayerX(Index) < MAX_MAPX Then
                 ' Check to make sure that the tile is walkable
                 If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then
                     ' Check to see if the tile is a key and if it is check if its opened
                     If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) + 1, GetPlayerY(Index)) = YES) Then
                           ' Check to see if the tile is a door and if it is check if its opened
                           If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_DOOR Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) + 1, GetPlayerY(Index)) = YES) Then
                               Call SetPlayerX(Index, GetPlayerX(Index) + 1)
                              
                               packet = "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & Movement & SEP_CHAR & END_CHAR
                               Call SendDataToMapBut(Index, GetPlayerMap(Index), packet)
                               Moved = YES
                           End If
                     End If
                 End If
             Else
                 ' Check to see if we can move them to the another map
                 If Map(GetPlayerMap(Index)).Right > 0 Then
                     Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Right, 0, GetPlayerY(Index))
                     Moved = YES
                 End If
             End If
    End Select



find key trigger tile at the bottem of playermove and add

    '  ///////////////////////
    ' //check for door tile//
    '///////////////////////
    x = GetPlayerX(Index)
    y = GetPlayerY(Index)
   
    'check if doors on players left
    If Map(GetPlayerMap(Index)).Tile(x - 1, y).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(x - 1, y) = NO Then
        TempTile(GetPlayerMap(Index)).DoorOpen(x - 1, y) = YES
        TempTile(GetPlayerMap(Index)).DoorTimer = GetTickCount
       
        Call SendDataToMap(GetPlayerMap(Index), "MAPKEY" & SEP_CHAR & x - 1 & SEP_CHAR & y & SEP_CHAR & 1 & SEP_CHAR & END_CHAR)
        Call MapMsg(GetPlayerMap(Index), "A door has been unlocked.", White)
    End If
   
    'check if doors on players right
    If Map(GetPlayerMap(Index)).Tile(x + 1, y).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(x + 1, y) = NO Then
        TempTile(GetPlayerMap(Index)).DoorOpen(x + 1, y) = YES
        TempTile(GetPlayerMap(Index)).DoorTimer = GetTickCount
       
        Call SendDataToMap(GetPlayerMap(Index), "MAPKEY" & SEP_CHAR & x + 1 & SEP_CHAR & y & SEP_CHAR & 1 & SEP_CHAR & END_CHAR)
        Call MapMsg(GetPlayerMap(Index), "A door has been unlocked.", White)
    End If
   
    'check if doors above player
    If Map(GetPlayerMap(Index)).Tile(x, y - 1).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(x, y - 1) = NO Then
        TempTile(GetPlayerMap(Index)).DoorOpen(x, y - 1) = YES
        TempTile(GetPlayerMap(Index)).DoorTimer = GetTickCount
       
        Call SendDataToMap(GetPlayerMap(Index), "MAPKEY" & SEP_CHAR & x & SEP_CHAR & y - 1 & SEP_CHAR & 1 & SEP_CHAR & END_CHAR)
        Call MapMsg(GetPlayerMap(Index), "A door has been unlocked.", White)
    End If
   
    'check of doors below player
    If Map(GetPlayerMap(Index)).Tile(x, y + 1).Type = TILE_TYPE_DOOR And TempTile(GetPlayerMap(Index)).DoorOpen(x, y + 1) = NO Then
        TempTile(GetPlayerMap(Index)).DoorOpen(x, y + 1) = YES
        TempTile(GetPlayerMap(Index)).DoorTimer = GetTickCount
        Call SendDataToMap(GetPlayerMap(Index), "MAPKEY" & SEP_CHAR & x & SEP_CHAR & y + 1 & SEP_CHAR & 1 & SEP_CHAR & END_CHAR)
        Call MapMsg(GetPlayerMap(Index), "A door has been unlocked.", White)
    End If



now find in modgeneral in gameai

If Map(y).Tile(x1, y1).Type = TILE_TYPE_KEY



and replace it with

If Map(y).Tile(x1, y1).Type = TILE_TYPE_KEY or tile_type_door





ok that was all server side, now to edit client


find in modgamelogic, gameloop

If .Type = TILE_TYPE_MESSAGE Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "M", QBColor(Yellow))


and add underneath

If .Type = TILE_TYPE_DOOR Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "D", QBColor(Pink))



now replace the whole of canmove function in modgamelogic with


Function CanMove() As Boolean
Dim i As Long, d As Long

    CanMove = True
   
    ' Make sure they aren't trying to move when they are already moving
    If Player(MyIndex).Moving <> 0 Then
        CanMove = False
        Exit Function
    End If
   
    ' Make sure they haven't just casted a spell
    If Player(MyIndex).CastedSpell = YES Then
        If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
             Player(MyIndex).CastedSpell = NO
        Else
             CanMove = False
             Exit Function
        End If
    End If
   
    d = GetPlayerDir(MyIndex)
    If DirUp Then
        Call SetPlayerDir(MyIndex, DIR_UP)
       
        ' Check to see if they are trying to go out of bounds
        If GetPlayerY(MyIndex) > 0 Then
             ' Check to see if the map tile is blocked or not
             If Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).Type = TILE_TYPE_BLOCKED Then
                 CanMove = False
                
                 ' Set the new direction if they weren't facing that direction
                 If d <> DIR_UP Then
                     Call SendPlayerDir
                 End If
                 Exit Function
             End If
                                            
             ' Check to see if the key door is open or not
             If Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).Type = TILE_TYPE_KEY Or Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).Type = TILE_TYPE_DOOR Then
                 ' This actually checks if its open or not
                 If TempTile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) - 1).DoorOpen = NO Then
                     CanMove = False
                
                     ' Set the new direction if they weren't facing that direction
                     If d <> DIR_UP Then
                           Call SendPlayerDir
                     End If
                     Exit Function
                 End If
             End If
            
             ' Check to see if a player is already on that tile
             For i = 1 To MAX_PLAYERS
                 If IsPlaying(i) Then
                     If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                           If (GetPlayerX(i) = GetPlayerX(MyIndex)) And (GetPlayerY(i) = GetPlayerY(MyIndex) - 1) Then
                               CanMove = False
                          
                               ' Set the new direction if they weren't facing that direction
                               If d <> DIR_UP Then
                                   Call SendPlayerDir
                               End If
                               Exit Function
                           End If
                     End If
                 End If
             Next i
       
             ' Check to see if a npc is already on that tile
             For i = 1 To MAX_MAP_NPCS
                 If MapNpc(i).Num > 0 Then
                     If (MapNpc(i).x = GetPlayerX(MyIndex)) And (MapNpc(i).y = GetPlayerY(MyIndex) - 1) Then
                           CanMove = False
                          
                           ' Set the new direction if they weren't facing that direction
                           If d <> DIR_UP Then
                               Call SendPlayerDir
                           End If
                           Exit Function
                     End If
                 End If
             Next i
        Else
             ' Check if they can warp to a new map
             If Map.Up > 0 Then
                 Call SendPlayerRequestNewMap
                 GettingMap = True
             End If
             CanMove = False
             Exit Function
        End If
    End If
            
    If DirDown Then
        Call SetPlayerDir(MyIndex, DIR_DOWN)
       
        ' Check to see if they are trying to go out of bounds
        If GetPlayerY(MyIndex) < MAX_MAPY Then
             ' Check to see if the map tile is blocked or not
             If Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) + 1).Type = TILE_TYPE_BLOCKED Then
                 CanMove = False
                
                 ' Set the new direction if they weren't facing that direction
                 If d <> DIR_DOWN Then
                     Call SendPlayerDir
                 End If
                 Exit Function
             End If
                                            
             ' Check to see if the key door is open or not
             If Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) + 1).Type = TILE_TYPE_KEY Or Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) + 1).Type = TILE_TYPE_DOOR Then
                 ' This actually checks if its open or not
                 If TempTile(GetPlayerX(MyIndex), GetPlayerY(MyIndex) + 1).DoorOpen = NO Then
                     CanMove = False
                
                     ' Set the new direction if they weren't facing that direction
                     If d <> DIR_DOWN Then
                           Call SendPlayerDir
                     End If
                     Exit Function
                 End If
             End If
            
             ' Check to see if a player is already on that tile
             For i = 1 To MAX_PLAYERS
                 If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                     If (GetPlayerX(i) = GetPlayerX(MyIndex)) And (GetPlayerY(i) = GetPlayerY(MyIndex) + 1) Then
                           CanMove = False
                          
                           ' Set the new direction if they weren't facing that direction
                           If d <> DIR_DOWN Then
                               Call SendPlayerDir
                           End If
                           Exit Function
                     End If
                 End If
             Next i
            
             ' Check to see if a npc is already on that tile
             For i = 1 To MAX_MAP_NPCS
                 If MapNpc(i).Num > 0 Then
                     If (MapNpc(i).x = GetPlayerX(MyIndex)) And (MapNpc(i).y = GetPlayerY(MyIndex) + 1) Then
                           CanMove = False
                          
                           ' Set the new direction if they weren't facing that direction
                           If d <> DIR_DOWN Then
                               Call SendPlayerDir
                           End If
                           Exit Function
                     End If
                 End If
             Next i
        Else
             ' Check if they can warp to a new map
             If Map.Down > 0 Then
                 Call SendPlayerRequestNewMap
                 GettingMap = True
             End If
             CanMove = False
             Exit Function
        End If
    End If
                
    If DirLeft Then
        Call SetPlayerDir(MyIndex, DIR_LEFT)
       
        ' Check to see if they are trying to go out of bounds
        If GetPlayerX(MyIndex) > 0 Then
             ' Check to see if the map tile is blocked or not
             If Map.Tile(GetPlayerX(MyIndex) - 1, GetPlayerY(MyIndex)).Type = TILE_TYPE_BLOCKED Then
                 CanMove = False
                
                 ' Set the new direction if they weren't facing that direction
                 If d <> DIR_LEFT Then
                     Call SendPlayerDir
                 End If
                 Exit Function
             End If
                                            
             ' Check to see if the key door is open or not
             If Map.Tile(GetPlayerX(MyIndex) - 1, GetPlayerY(MyIndex)).Type = TILE_TYPE_KEY Or Map.Tile(GetPlayerX(MyIndex) - 1, GetPlayerY(MyIndex)).Type = TILE_TYPE_DOOR Then
                 ' This actually checks if its open or not
                 If TempTile(GetPlayerX(MyIndex) - 1, GetPlayerY(MyIndex)).DoorOpen = NO Then
                     CanMove = False
                    
                     ' Set the new direction if they weren't facing that direction
                     If d <> DIR_LEFT Then
                           Call SendPlayerDir
                     End If
                     Exit Function
                 End If
             End If
            
             ' Check to see if a player is already on that tile
             For i = 1 To MAX_PLAYERS
                 If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                     If (GetPlayerX(i) = GetPlayerX(MyIndex) - 1) And (GetPlayerY(i) = GetPlayerY(MyIndex)) Then
                           CanMove = False
                          
                           ' Set the new direction if they weren't facing that direction
                           If d <> DIR_LEFT Then
                               Call SendPlayerDir
                           End If
                           Exit Function
                     End If
                 End If
             Next i
       
             ' Check to see if a npc is already on that tile
             For i = 1 To MAX_MAP_NPCS
                 If MapNpc(i).Num > 0 Then
                     If (MapNpc(i).x = GetPlayerX(MyIndex) - 1) And (MapNpc(