Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Game Development with Phaser!
You have completed Game Development with Phaser!
Preview
Explore how to add logic to our game when physics bodies collide in Phaser and understand how this can be utilized to trigger actions or implement game mechanics when objects in our game world collide.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
and we also added some collisions
between the ball and the bricks.
0:00
In this video,
0:00
we're going to add some logic to make
the brick disappear when the ball hits it.
0:01
We'll also add some logic to bounce the
ball at an angle after it hits a brick.
0:06
Near the bottom of our
creates function on line 61,
0:12
we've created a collider between
the ball and the brick group.
0:15
The collider methods can take a callback
function as a third argument.
0:20
Let's add one called hit brick.
0:25
We can do that by adding a comma after
brick group and writing hit brick.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up