
- create Coin
- add Circle Collider 2D
- make it Trigger Collider by checking Is Trigger
- add RigidBody2D
- make it Static Collider
- add Circle Collider 2D

- in OnTriggerEnter2D() method,
- if a collision with Coin happens
- add score by 10
- destroy the gameObject itself (=Coin)
- OnTriggerEnter2D vs OnCollisionEnter2D
- When there are TriggerColliders, use OnTriggerEnter2D
- When there are normal Colliders, use OnCollisionEnter2D
- if a collision with Coin happens


- Uncheck “Queries Start in Colliders”
- I guess Query there means anything to detect in physics such as RayCast
- with that option checked, RayCasting starts from the inside of collider attached to GameObjects
- with that option unchecked, RayCasting Starts from the collider attached to GameObjects

- Tag as “Enemy”
- Set the layer as “Default”

- create a function, PlayerRayCast(),
- attach RayCast by using RayCastHit2D, and Physics2D.RayCast(vector2 origin, vector2 direction)
- create an if statment,
- give Player jump by using GetComponent<RigidBody2D>.AddForce()

- Add PlayerRayCast() function in Update() method


- put Enemy back in IgnoreRayCast Layer

- with the option, “Queries Start in Colliders” unchecked, Enemy is moving correctly because RayCasting Starts from the exterior of Collider attacked to Enemy
- with the fact that Enemy belongs to Ignore RayCast layer, the RayCasting feature is not working

- in Update() method,
- with the Raycasting feature, Enemy detects other objects horizontally
- in the horizon, if Enemy collides with Player, Destroy Player


- in PlayerRayCast(),
- set if statements with the conditions,
- if Player hit anything, and if it is Enemy, make Player jump on Enemy
- if Player hit anything, and if it is not Enemy, set the flag for jump as true
- set if statements with the conditions,
















