JS: Game Obstacles

Let's turn some of the game components into obstacles to make the game more interesting.

Adding collision function

As we saw at the end of the previous lesson, our character object passed through the obstacles like we pass our fingers through the liquid. So, we need to turn these component obstacles into solid. Hence, we will define a method inside the character object that will prevent the character from passing through those collisions.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy