Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix solid objects collider issue #19

Merged
merged 2 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Pokemon RPG/Assets/Scenes/New Scene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -6525,6 +6525,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
moveSpeed: 5
solidObjectsLayer:
serializedVersion: 2
m_Bits: 256
--- !u!212 &741721365
SpriteRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -6583,7 +6586,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 741721363}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3, y: 3.5, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down
2 changes: 1 addition & 1 deletion Pokemon RPG/Assets/Scripts/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ IEnumerator Move(Vector3 targetPos) { // Do something over a period of time (IEn
}

private bool IsWalkable(Vector3 targetPos) { // Check if the tile position is walkable
if (Physics2D.OverlapCircle(targetPos, 0.3f, SolidObjects, solidObjectsLayer) != null) // Tile is not walkable if the IF statement is not null, as there is something at that Vector3 position // Solid objects layer as third parameter
if (Physics2D.OverlapCircle(targetPos, 0.3f, solidObjectsLayer) != null) // Tile is not walkable if the IF statement is not null, as there is something at that Vector3 position // Solid objects layer as third parameter
{
return false;
}
Expand Down
8 changes: 8 additions & 0 deletions Pokemon RPG/Assets/Tiles/tilesets.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading