Group members: this is the place for your learning diary. Use this to post your zipped-up site at least once each unit, and your reflections as often as you wish (at least once per unit). Please write your reflections directly in the post, not as attached files. Where you do need to attach documents, such as for unit 1 designs, use PDF, PNG or JPG formats. You can attach files using the 'Embed content' link in the editor.
QUICK COURSE LINKS: Add blog post - Read latest group posts - FAQs: Course process : Site design : HTML : CSS : JavaScript : JQuery : AJAX : Misc : Podcasts for each unit
Updated resource pages: Unit 1 - Unit 2 - Unit 3 - Units 4 & 5 - Unit 6 - Unit 7
mportant notice: the student web server is unavailable. Until this is fixed, we do not require you to upload your site to the student server. See Running a web server on your local machine for details of how to meet the requirements for the final unit
Hey All! Here is my final Learning Diary for Unit 5.
Throughout the course of Unit 5, I put extensive work into the generation of ideas, development of designs, and final implementation of code.
From my three main ideas, I developed two designs, a design for a dynamic web-based Asteroids game, and a design for a "continue reading" feature on the website. From my designs, I decided to develop the Asteroids game. The result of my work can be seen in asteroids.js, asteroids.html and asteroids.css.
The asteroids game is inspired by the classic "Asteroids" arcade game. In this game, players control a ship to destroy asteroids as they navigate around an asteroid field. The purpose of the game is to give hiring managers a glimpse into my personality while showing off my technical abilities. The code does an excellent job meeting both these purposes. It demonstrates my ability to develop software, while also showing that I am a positive and fun individual.
From a technical standpoint, the asteroids.js program operates as follows:
The user accesses the program from index.html by pressing the "fun!" button at the top of the page. This button is only available on non-mobile devices, and directs the user to the asteroids game. The game starts with the player's ship at the centre of the HTML Canvas, which is configured to be the size of the browser window. The draw() function is called to draws objects such as instances of Asteroids, Bullet and Ship.
The player is meant to use the arrow keys to control the ship, and the space key to shoot bullets at the asteroids. The player has three lives which are decremented when an asteroid hits the ship. If the number of lives reaches zero, the game is reset.
If the player destroys all the asteroids, more asteroids are automatically generated. The player can choose to leave the game by pressing the "go back to the home page" button at the buttom right corner of the screen.
Throughout my time programming Asteroids, I learned a number of Javascript and programming techniques. While programming, I would read Mozilla MDN Web Docs, as I found it to be a great resource on not only Javascript, but also HTML and CSS. The majority of what I referenced was Javascript syntax, such as specific ways for declaring objects, and how to use Javascript arrays. The following are some of the things I learned while programming:
I had the opportunity to learn how to use event listeners to detect if a key was pressed, or if the size the browser window was modified. HTML DOM EVENTS are extensive, and essentially allow you to attach a function to an event.
I learned about push() and splice() two advanced operations that you can perform on an array to improve the performance and efficiency of your program. push() allows you to append an object or value to an array. splice() removes an element from the array. I used push to dynamically add objects to arrays, and used splice to remove objects. Splice() was an important to allow me to "destroy" asteroids and bullets in my Asteroids game. Using splice(), I could set an object up for garbage collection, which allows me to generate effectively limitless quantities of asteroids and bullets while keeping my code very efficient.
Another important aspect of arrays is the array.length() property. This was important in allowing me to write for-loops that iterate fully through an array regardless of it's length.
requestAnimationFrame is an important feature of javascript that enabled me to develop a game. It acts as a callback, executing a function repeatedly. This featured allowed me to draw objects to an HTML canvas at 60FPS, making the drawings appear as if they're moving. Interestingly, this feature taught me about "callback references", because the function returns a reference to the recurring function, that you need to store in order to cancel the requestAnimationFrame at the end of the game.
The most important part of the Asteroids program is the HTML canvas, which allows for the drawing of Javascript graphics on-the-fly.
In terms of debugging, there were a number of times I needed to debug the code. Specifically, the game was very heavy in math and required the calculation of velocities and accelerations to generate realistic physics for the ship, bullets and asteroids. This math required a lot of trial and error in order to get correct. I would often manipulate single values and test the code in order to tweak the motion to my liking.
The graphics themselves were also difficult to generate, as they required a complex understanding of vector math. For example, the player's ship is a triangle described by three points in space. In order to rotate the ship, I needed to calculate how the three points should move relative to one another, regardless of the triangles location in space. Surprisingly, This was mostly based in trigonometry from high-school.
Lastly, there were a few times where I developed loops that resulted in "segmentation faults", by accessing memory at incorrect indexes in an array. These faults were immediately obvious, and corrected through program testing.
I have used all the concepts and constructs required. Specifically, I have used comments, sequence, selection, iteration, variables, variable declarations, arrays, functions, objects. Additionally, I have gone above and beyond by using recursion in the case of my createAsteroidBelt(numberAsteroids) function.
I make effective use of variables, and use techniques such as parameter passing (i.e. line 95) , local variables (i.e. line 215 asteroids.js), global variables (i.e. lines 5-14 asteroids.js) and arrays (i.e. lines 10-11 asteroids.js) to improve efficiency of my code.
SCIS Web Space (working-copy): http://student.athabascau.ca/~jamalha2/
Permanent Location for Unit 5 HTML Files on SCIS: http://student.athabascau.ca/~jamalha2/unit5/
Github Pages: http://jamalhabash.ca/comp266/
The Landing is a social site for Athabasca University staff, students and invited guests. It is a space where they can share, communicate and connect with anyone or everyone.
Unless you are logged in, you will only be able to see the fraction of posts on the site that have been made public. Right now you are not logged in.
If you have an Athabasca University login ID, use your standard username and password to access this site.
We welcome comments on public posts from members of the public. Please note, however, that all comments made on public posts must be moderated by their owners before they become visible on the site. The owner of the post (and no one else) has to do that.
If you want the full range of features and you have a login ID, log in using the links at the top of the page or at https://landing.athabascau.ca/login (logins are secure and encrypted)
Posts made here are the responsibility of their owners and may not reflect the views of Athabasca University.