| Mirage Source http://www.miragesource.net/forums/ |
|
| Side Stepping Problemo.. http://www.miragesource.net/forums/viewtopic.php?f=201&t=364 |
Page 1 of 1 |
| Author: | Dark Echo [ Thu Aug 10, 2006 11:05 am ] |
| Post subject: | Side Stepping Problemo.. |
Hey guys, i was bored today so i thought i'd work on adding in sidestepping.. Now this works, but there seems to be an annoying bug and i cant seem to find a fix for it.. Now, there are two bugs.. First one is that it doesnt seem to be able to register what direction the character is facing until you press the sidestep button a second time.. Meaning that when you press the sidestep button, be it left or right, the character jumps diagonally.. Second annoying bug is that after using the sidestep a few times. Approximately 10 times. The character on screen will slide sideways until it hits the end of the map.. Now, i've seen that before, and i cannot remember what causes it.. I was thinking of maybe an overflow error somewhere, but yeah.. It doesnt pop up with any error messages.. Here is the main engine of the whole sidestepping business.. I dont think it has much to do with this, but yeah.. Like i said, i have no idea whats causing this problem.. It would be awesome if someone could give us a bit of help on this.. Cheers.. Code: Sub PlayerSideStep(ByVal Index As Long, ByVal LeftRight As Long)
Dim i As Long ' Check for subscript out of range If IsPlaying(Index) = False Then Exit Sub End If ' Move player left or right Select Case LeftRight Case SIDESTEP_LEFT Select Case GetPlayerDir(Index) Case DIR_UP ' Check to make sure the player isnt out of bounds If GetPlayerX(Index) > 0 Then ' Check for edge of map If GetPlayerX(Index) <> 0 Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then ' Check for key If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index) - 1) And (GetPlayerY(i) = GetPlayerY(Index)) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index) - 1) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index)) Then Exit Sub End If End If Next i ' Move player Call SetPlayerX(Index, GetPlayerX(Index) - 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub Case DIR_DOWN ' Check to make sure the player isnt out of bounds If GetPlayerX(Index) > 0 Then ' Check for edge of map If GetPlayerX(Index) <> MAX_MAPX Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index) + 1) And (GetPlayerY(i) = GetPlayerY(Index)) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index) + 1) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index)) Then Exit Sub End If End If Next i ' Move player Call SetPlayerX(Index, GetPlayerX(Index) + 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub Case DIR_LEFT ' Check to make sure the player isnt out of bounds If GetPlayerY(Index) > 0 Then ' Check for edge of map If GetPlayerY(Index) <> MAX_MAPY Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index)) And (GetPlayerY(i) = GetPlayerY(Index) + 1) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index)) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index) + 1) Then Exit Sub End If End If Next i ' Move player Call SetPlayerY(Index, GetPlayerY(Index) + 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub Case DIR_RIGHT ' Check to make sure the player isnt out of bounds If GetPlayerY(Index) > 0 Then ' Check for edge of map If GetPlayerY(Index) <> 0 Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index)) And (GetPlayerY(i) = GetPlayerY(Index) - 1) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index)) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index) - 1) Then Exit Sub End If End If Next i ' Move player Call SetPlayerY(Index, GetPlayerY(Index) - 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub End Select Case SIDESTEP_RIGHT Select Case GetPlayerDir(Index) Case DIR_UP ' Check to make sure the player isnt out of bounds If GetPlayerX(Index) > 0 Then ' Check for edge of map If GetPlayerY(Index) <> MAX_MAPY Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index) + 1) And (GetPlayerY(i) = GetPlayerY(Index)) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index) + 1) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index)) Then Exit Sub End If End If Next i ' Move player Call SetPlayerX(Index, GetPlayerX(Index) + 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub Case DIR_DOWN ' Check to make sure the player isnt out of bounds If GetPlayerX(Index) > 0 Then ' Check for edge of map If GetPlayerY(Index) <> 0 Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index) - 1) And (GetPlayerY(i) = GetPlayerY(Index)) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index) - 1) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index)) Then Exit Sub End If End If Next i ' Move player Call SetPlayerX(Index, GetPlayerX(Index) - 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub Case DIR_LEFT ' Check to make sure the player isnt out of bounds If GetPlayerY(Index) > 0 Then ' Check for edge of map If GetPlayerY(Index) <> 0 Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index)) And (GetPlayerY(i) = GetPlayerY(Index) - 1) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index)) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index) - 1) Then Exit Sub End If End If Next i ' Move player Call SetPlayerY(Index, GetPlayerY(Index) - 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub Case DIR_RIGHT ' Check to make sure the player isnt out of bounds If GetPlayerY(Index) > 0 Then ' Check for edge of map If GetPlayerY(Index) <> MAX_MAPY Then ' Check for blocks If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_BLOCKED Then ' Check for key and check if its open If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_KEY Then ' Check for players For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(Index) Then If (GetPlayerX(i) = GetPlayerX(Index)) And (GetPlayerY(i) = GetPlayerY(Index) + 1) Then Exit Sub End If End If End If Next i ' Check for npcs For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If (MapNpc(GetPlayerMap(Index), i).x = GetPlayerX(Index)) And (MapNpc(GetPlayerMap(Index), i).y = GetPlayerY(Index) + 1) Then Exit Sub End If End If Next i ' Move player Call SetPlayerY(Index, GetPlayerY(Index) + 1) End If End If End If End If ' Send new X or Y coords and send it to everyone on the map Call SendPlayerXY(Index) Call SendDataToMap(GetPlayerMap(Index), "PLAYERMOVE" & SEP_CHAR & Index & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & 0 & SEP_CHAR & END_CHAR) Exit Sub End Select End Select End Sub |
|
| Author: | Anarchy [ Fri Aug 11, 2006 1:01 am ] |
| Post subject: | Re: Side Stepping Problemo.. |
The character on screen will slide sideways until it hits the end of the map.. Now, i've seen that before, and i cannot remember what causes it.. I was thinking of maybe an overflow error somewhere, but yeah.. It doesnt pop up with any error messages lol pws and 3.03 |
|
| Author: | Dark Echo [ Fri Aug 11, 2006 9:00 am ] |
| Post subject: | |
Huh?.... pws and 303?.... Sorry im lost.. |
|
| Author: | Matt [ Fri Aug 11, 2006 3:34 pm ] |
| Post subject: | |
I think he meant, that those are things that happen in PW and MS 3.0.3, though I'm not sure, since, I've never had those problems, cept when I set the walking speed off. Maybe that's your problem, have you altered the walk/run speed? |
|
| Author: | Robin [ Fri Aug 11, 2006 9:11 pm ] |
| Post subject: | |
Advocate wrote: I think he meant, that those are things that happen in PW and MS 3.0.3, though I'm not sure, since, I've never had those problems, cept when I set the walking speed off.
Maybe that's your problem, have you altered the walk/run speed? If he had, the character would crash even if he wasn't side-stepping. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|