Game Design
We will combine all the above materials to design a web page to illustrate the Newton’s mechanics theorem in physics. The goal is to use the Webduino Bit to control the cannon and shoot the ball into the red circle.
We will use the roll and pitch values of Bit board to control the speed and angles of the shot ball.
First we will design a pure HTML/CSS/JS version. Then we will add the Bit board function. The codes are a little complex compared to the previous units. But we almost finish all the parts needed to construct such a program. I will show you the codes and result, and leave the explanations to you.
Web only version
The codes are shown in the following. If you want a full screen page, click here.
Webduino Bit version
The Bit version can only be controlled by the Bit board. I will only demonstrate the result for you by using this link (it's only for my Bit board). You should go into the jsFiddle and change the Device ID to yours, then you can run the game by using your Bit board.
Exercise
- Try to explore the source codes and see if you can understand the codes by yourself.
- You may try to modify or add something to the page by using what you have learned.
Final Project
This is the last unit. Try to use what you have learned till now to create a simple page or application.