Fix Straight NPC movement better
This commit is contained in:
parent
3649717883
commit
15dd897e9a
|
@ -797,39 +797,55 @@
|
||||||
newPosition = New Vector3(CInt(newPosition.X), CInt(newPosition.Y), CInt(newPosition.Z))
|
newPosition = New Vector3(CInt(newPosition.X), CInt(newPosition.Y), CInt(newPosition.Z))
|
||||||
Dim oldPosition As Vector3 = Me.Position
|
Dim oldPosition As Vector3 = Me.Position
|
||||||
|
|
||||||
Dim interactPlayer As Boolean = False
|
Dim blocked As Boolean = False
|
||||||
|
|
||||||
|
'' check if player or a following Pokémon is not in the way
|
||||||
If Screen.Camera.IsMoving() = False Then
|
If Screen.Camera.IsMoving() = False Then
|
||||||
If CInt(Screen.Camera.Position.X) = newPosition.X And CInt(Screen.Camera.Position.Z) = newPosition.Z Then
|
If CInt(Screen.Camera.Position.X) = newPosition.X And CInt(Screen.Camera.Position.Y) = newPosition.Y And CInt(Screen.Camera.Position.Z) = newPosition.Z Then
|
||||||
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z Then
|
blocked = True
|
||||||
interactPlayer = True
|
End If
|
||||||
|
If Screen.Level.OverworldPokemon.IsVisible = True Then
|
||||||
|
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Y) = newPosition.Y And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z Then
|
||||||
|
blocked = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Dim cameraNewPosition As Vector3 = CType(Screen.Camera, OverworldCamera).LastStepPosition + Screen.Camera.PlannedMovement()
|
Dim cameraNewPosition As Vector3 = CType(Screen.Camera, OverworldCamera).LastStepPosition + Screen.Camera.PlannedMovement()
|
||||||
If CInt(cameraNewPosition.X) = newPosition.X And CInt(cameraNewPosition.Z) = newPosition.Z Then
|
Dim cameraOldPosition As Vector3 = CType(Screen.Camera, OverworldCamera).LastStepPosition
|
||||||
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z Then
|
|
||||||
interactPlayer = True
|
If CInt(cameraNewPosition.X) = newPosition.X And CInt(cameraNewPosition.Y) = newPosition.Y And CInt(cameraNewPosition.Z) = newPosition.Z Then
|
||||||
|
blocked = True
|
||||||
|
End If
|
||||||
|
If Screen.Level.OverworldPokemon.IsVisible = True Then
|
||||||
|
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Y) = newPosition.Y And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z OrElse
|
||||||
|
CInt(cameraOldPosition.X) = newPosition.X And CInt(cameraOldPosition.Y) = newPosition.Y And CInt(cameraOldPosition.Z) = newPosition.Z Then
|
||||||
|
blocked = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'' check if a NetworkPlayer is not in the way
|
'' check if a NetworkPlayer is not in the way
|
||||||
For Each Player As NetworkPlayer In Screen.Level.NetworkPlayers
|
For Each Player As NetworkPlayer In Screen.Level.NetworkPlayers
|
||||||
If CInt(Player.Position.X) = newPosition.X And CInt(Player.Position.Z) = newPosition.Z Then
|
If CInt(Player.Position.X) = newPosition.X And CInt(Player.Position.Y) = newPosition.Y And CInt(Player.Position.Z) = newPosition.Z Then
|
||||||
interactPlayer = True
|
blocked = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
'' check if a NetworkPokémon is not in the way
|
'' check if a NetworkPokémon is not in the way
|
||||||
For Each Pokemon As NetworkPokemon In Screen.Level.NetworkPokemon
|
For Each Pokemon As NetworkPokemon In Screen.Level.NetworkPokemon
|
||||||
If CInt(Pokemon.Position.X) = newPosition.X And CInt(Pokemon.Position.Z) = newPosition.Z Then
|
If CInt(Pokemon.Position.X) = newPosition.X And CInt(Pokemon.Position.Y) = newPosition.Y And CInt(Pokemon.Position.Z) = newPosition.Z Then
|
||||||
interactPlayer = True
|
blocked = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
'' check if an NPC is not in the way
|
||||||
|
For Each NPC As NPC In Screen.Level.GetNPCs()
|
||||||
|
If CInt(NPC.Position.X) = newPosition.X And CInt(NPC.Position.Y) = newPosition.Y And CInt(NPC.Position.Z) = newPosition.Z And NPC.NPCID <> Me.NPCID Then
|
||||||
|
blocked = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If interactPlayer = True Then
|
If blocked = True Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -863,39 +879,38 @@
|
||||||
|
|
||||||
'' check if player or a following Pokémon is not in the way
|
'' check if player or a following Pokémon is not in the way
|
||||||
If Screen.Camera.IsMoving() = False Then
|
If Screen.Camera.IsMoving() = False Then
|
||||||
If CInt(Screen.Camera.Position.X) = newPosition.X And CInt(Screen.Camera.Position.Z) = newPosition.Z Then
|
If CInt(Screen.Camera.Position.X) = newPosition.X And CInt(Screen.Camera.Position.Y) = newPosition.Y And CInt(Screen.Camera.Position.Z) = newPosition.Z Then
|
||||||
blocked = True
|
blocked = True
|
||||||
End If
|
End If
|
||||||
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z Then
|
If Screen.Level.OverworldPokemon.IsVisible = True Then
|
||||||
blocked = True
|
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Y) = newPosition.Y And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z Then
|
||||||
|
blocked = True
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Dim cameraNewPosition As Vector3 = Screen.Camera.GetForwardMovedPosition()
|
Dim cameraNewPosition As Vector3 = CType(Screen.Camera, OverworldCamera).LastStepPosition + Screen.Camera.PlannedMovement()
|
||||||
Dim cameraOldPosition As Vector3 = Screen.Camera.GetForwardMovedPosition() - Screen.Camera.GetMoveDirection()
|
Dim cameraOldPosition As Vector3 = CType(Screen.Camera, OverworldCamera).LastStepPosition
|
||||||
If CInt(cameraNewPosition.X) = newPosition.X And CInt(cameraNewPosition.Z) = newPosition.Z Or CInt(cameraOldPosition.X) = newPosition.X And CInt(cameraOldPosition.Z) = newPosition.Z Then
|
|
||||||
|
If CInt(cameraNewPosition.X) = newPosition.X And CInt(cameraNewPosition.Y) = newPosition.Y And CInt(cameraNewPosition.Z) = newPosition.Z Then
|
||||||
blocked = True
|
blocked = True
|
||||||
End If
|
End If
|
||||||
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z Then
|
If Screen.Level.OverworldPokemon.IsVisible = True Then
|
||||||
blocked = True
|
If CInt(Screen.Level.OverworldPokemon.Position.X) = newPosition.X And CInt(Screen.Level.OverworldPokemon.Position.Y) = newPosition.Y And CInt(Screen.Level.OverworldPokemon.Position.Z) = newPosition.Z OrElse
|
||||||
|
CInt(cameraOldPosition.X) = newPosition.X And CInt(cameraOldPosition.Y) = newPosition.Y And CInt(cameraOldPosition.Z) = newPosition.Z Then
|
||||||
|
blocked = True
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
'' check if a NetworkPlayer is not in the way
|
'' check if a NetworkPlayer is not in the way
|
||||||
For Each Player As NetworkPlayer In Screen.Level.NetworkPlayers
|
For Each Player As NetworkPlayer In Screen.Level.NetworkPlayers
|
||||||
If CInt(Player.Position.X) = newPosition.X And CInt(Player.Position.Z) = newPosition.Z Then
|
If CInt(Player.Position.X) = newPosition.X And CInt(Player.Position.Y) = newPosition.Y And CInt(Player.Position.Z) = newPosition.Z Then
|
||||||
blocked = True
|
blocked = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
'' check if a NetworkPokémon is not in the way
|
'' check if a NetworkPokémon is not in the way
|
||||||
For Each Pokemon As NetworkPokemon In Screen.Level.NetworkPokemon
|
For Each Pokemon As NetworkPokemon In Screen.Level.NetworkPokemon
|
||||||
If CInt(Pokemon.Position.X) = newPosition.X And CInt(Pokemon.Position.Z) = newPosition.Z Then
|
If CInt(Pokemon.Position.X) = newPosition.X And CInt(Pokemon.Position.Y) = newPosition.Y And CInt(Pokemon.Position.Z) = newPosition.Z Then
|
||||||
blocked = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
'' check if an NPC is not in the way
|
|
||||||
For Each NPC As NPC In Screen.Level.GetNPCs()
|
|
||||||
If CInt(NPC.Position.X) = newPosition.X And CInt(NPC.Position.Z) = newPosition.Z And NPC.NPCID <> Me.NPCID Then
|
|
||||||
blocked = True
|
blocked = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
Loading…
Reference in New Issue