![]() ![]() Object velocities are calculated with a trigonometric algorithm that standardizes velocity rather than using slope. Misc: Collisions are handled by individual objects by sending properties to a universal collision function in the Util file. Rounded corners for buttons are a staple in today's web but drawing out something mildly complex can become laborious. However, canvas can be very unforgiving when trying to stylize elements. The basic shapes in use made this implementation feasible. This separation of concerns also allowed for a robust utility file where many functions are shared between the various objects.Ĭanvas: With the exception of background images, gun icons, and sound icons, Earth Defender is drawn entirely on canvas. Each object instantiates a "new Audio()" object, allowing for sound layering. This allows for delegation of drawing and collision logic to the object itself as well as an efficient way to handle sound effects. JavaScript Structure: Each projectile is an instance of that projectile's class. Tracks items that are rendered but do not affect actual gameplay (score, timer, shields, icons, sound, etc.)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |