Introduction
My eighth blog post will talk about our class concerning vectors and physics as well as our visit to the New York Hall of Science where we have seen many exhibits including the Connected Worlds Project.
The Bombing Game
My today’s idea for the physics linked project was to make a bomber plane that would drop bombs and the user would have to bomb drop at a red line marked on the map. If he succeeds, the bomb explodes, otherwise the bomb does not go of and the “MISSION FAILURE” message pops in the screen.
Creation
Despite the fact that the game might seem simple, it actually took me quite a while to make, since I encountered many bugs, which were hard to spot, because of JavaScript’s lack of error messages.
The first think I did after creating my board, was to create a Bomber class. In the class I would make the plane fly from the top right corner towards the top left, while moving relatively slowly, so the user will be able to aim and drop the bomb successfully. I only found a really nice plane PNG and therefore the plane looks quite cool as well.
Next I created a bomb class, which was also the most complicated one. The bomb would get coordinates inside the moving plane, since it has to be dropped from there. Furthermore, with the help of keyPressed class I made sure that this class would be created only if the user pressed CONTROL. Next, by using similar commands of the ones we used in class, I was able to make sure that the bomb would drop quite realistically via the help of an extra force, which is no other than gravity! Thus, the user will have to take this force into account, as well as the fact that the bomber is moving, therefore making the bomb drop quite realistic and resembling real circumstances of objects being dropped from other moving objects.
Furthermore, I also had to create a button variable which helped me trigger the functions inside the bomb class, since they would be triggered continuously inside the draw function, every time button is “TRUE”. At this point I had also experienced my greatest difficulty in this part. The problem is that every time I called the bomb class for the first time inside the Setup or Draw function the bomb would stay inside the plane and not drop at all. After a couple of hours of struggling, I realised that if I call the function from the KeyPressed function then it would work perfectly. After solving this annoying bug with the help of Lucas (he saved me) I was able to finish the rest of the code.
Next, I used some parameters, so in case the x or y values of the bomb were inside the red line, the bomb would detonate and the user would win. Otherwise, the bomb would not detonate and the “MISSION FAILURE” text will appear, since the user missed hitting the correct bombing location.
I hope you enjoy playing my game and enjoy numerous victories while playing. In the next days I am considering to create a score system for time for every consecutive victories, while the red line would become smaller and smaller and the plane moving faster.
New York Hall of Science
In this part of the blog, I would like to talk about our visit to the NY Hall of Science, which was quite an interesting visit that I really enjoyed. Despite the fact that we’ve seen many amazing mind games in the Hall of Science as well as math and science exhibits, the one that impressed me the most as well as the rest of the class I believe, was the Connected Worlds exhibit, which myself found mind blowing. Despite the interesting concept of having different numerous worlds being dependent on each other what impressed me the most was the technology used. All the Kinects, the monitors and the thermal cameras connected with each other in order to produce a technological masterpiece, where even the logs on the floor could be used to control the water flow coming from the waterfall.
Conclusion
In conclusion I have to say that it was an interesting class, since we talked about Physics and Vectors, which are really interesting subjects, as well seeing the Connected Worlds project which really amazed me.
Thanks for reading,
Christos