Landing : Athabascau University

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 postsFAQs: Course process : Site design : HTML : CSS : JavaScript : JQuery : AJAX : MiscPodcasts for each unit

Updated resource pages:  Unit 1 - Unit 2  - Unit 3Units 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

Unit Five Analysis and Design

  • Public
By Jesse McCarthy in the group COMP 266 December 15, 2016 - 6:52pm

 

Infinite Skies Banner

Create star at regular intervals at a random position on the canvas. When stars are created, they will fade in, increasing in size and opacity, and then fade out, decreasing in size and opacity. After fading out the stars will be deleted.

 

CanvasController

Contains main loop and objects that manipulate the canvas. The controller object was created to separate the main loop from the details of drawable objects and how they are manipulated. Personally, I find inner objects to be ideal for creating new levels of abstraction and maintaining a clean and workable base of objects. When objects contain too much functionality I find it difficult to read and navigate through the source code.

 

CONTAINS:

-          Controller

 

INIT

-          Set up canvas and context for drawing

-          Create Controller that will manipulate all objects

-          Set frame rate

 

Main Loop

-          Update Controller

-          Draw all objects contained within Controller

 

Controller

Contains and coordinates all objects.

CONTAINS:

-          BgStar

-          BgStarController

 

INIT

-          Create new ImgCache containing all images that will be used on the banner

  • *** When images have completed loading, the main loop begins ***

-          Create a list starTypes

-          Create associative array objects to store objects

-          Create BgStarController

 

 

UPDATE (Function is called in the main loop)

-          Update objects

-          Garbage Collection

 

Draw (Function is called in the main loop)

-          Draw Background

-          Draw all objects

 



 

ObjectInterface

ObjectInterface is and interface for all instances that will be drawn to the screen, and that will be stored in the objects associative array from Controller. All objects are given three attributes.

  1. 1.      Update – empty update function, this is called in controller.update
  2. 2.      Draw – empty draw function, called in controller.draw
  3. 3.      Delete – delete attribute (default is false), used in garbageCollection

 

 BgStar

Implements ObjectInterface, generates several different random attributes. Fades in and then sets it’s delete attribute to true once it’s fade cycle has completed.

 

INIT

-          Randomize several attributes:

  • Star image
  • Scale
  • Rotation speed

-          Create Fader object

-          Create Img to draw itself to screen

 

UPDATE

-          Fader.fade fade object that runs through a series of opacities from 0 to 1 then back down from 1 to 0

-          isDelible checks if objects fade cycle has completed, and if so sets delete equal to true

 

DRAW

-          Draws itself with Img.draw passing in requires arguments such as scale, opacity, and rotation speed

 


 

BgStarController

Spawns new BgStars.

INIT

-          Create new Timer for spawning stars

 

UPDATE

-          Timer.tick, if timer fires spawn new star

Jesse McCarthy

Jesse McCarthy

About me

Aspiring software engineer and video game developer.