Add the basic logic to the various elements on screen.
- [Instructor] Hello, and welcome to Video 3.2,…Adding the Basic Game Logic.…In this video we're gonna talk about how to implement…the game logic into the existing stage…which we've created in a previous section.…If you recall, this is the way the stage looked…in the previous section.…We've added the bricks, we've added the ball,…and we've added the paddle.…Now we wish to add the game logic into the game…so that when the ball hits a brick it will disappear,…and so on and so forth.…
So let's take a look at the code.…This is the code from the previous section.…Now we're gonna add the required changes…to make the logic work.…So, first of all, let's do some clean-up.…In previous section we've created Ball…and in constant radius here we've added the value 8.…Since we're gonna need the ball radius…for various calculations…in order to determine the location of where the ball hit,…we're gonna add it as a constant.…
So we're gonna create a constant here,…call it BALL_RADIUS,…and we're gonna add the value 8.…And we'll add it instead of the existing value 8.…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Playing sounds in various browsers using SoundJS
- Tweening objects using TweenJS
- Creating graphic assets and basic animations
- Game stage creation and object positioning
- Adding the basic game logic
- Add the game physics
- Adding mouse and keyboard controls
- Debugging with breakpoints in Chrome
- Debugging on Android and iOS
- Character movement and input handling