

- Create a bool variable isGrounded as Flag
- Create OnCollisionEnter2D() method,
- when a collision with an object tagged “Ground”
- the flag is set to “true“
- when a collision with an object tagged “Ground”



- in Update() method,
- add code as a condition for Player to jump
- when the button is pressed and at the same time the flag is true(Player is grounded)
- in Jump() method,
- add code to set the flag to false



- Player is not jumping on Box because Box is not tagged as Ground

- Create Enemy
- add BoxCollider
- add RigidBody2D
- add EnemyControl Script

- Create variables for Enemy‘s speed and direction
- Enemy is moving horizontally only, so take care of X
- in Update() method
- access velocity property to move the gameObject by using GetComponent


- in Update() method,
- add RayCasting to perceive the obstacles
- Physics2D.RaycastHit2D(vector2 origin, vector2 direction)
- the origin where Ray is cast from is the current position of gameObject
- the direction of casting the ray is only x
- when the length of ray is less than 0.7,
- activate Flip()
- create a function, Flip(),
- change the direction in x opposite whenever this function is called

- put Enemy in Igonore Raycast layer
- set the speed


