Martin Fobert

PC Support Specialist Diploma (honours)

Desktop/Laptop Hardware and Operating System Technician

Software and Web Developer Diploma (honours)

Javascript, CSS3, HTML5

I believe that computer programming is where art and science collide. Where logic and mathematics meets creativity and imagination.

About

I have been a PC Support Specialist for over twelve years. That's an 'Operating System and Hardware Technician'. I've worked with Microsoft Operating systems from DOS 6.2 to Windows 11 and all the major stops in between. While working with Best Buy's Geek Squad, Canada Computers' Service Dept. and as an independent consultant I have assembled a plethora of desktop computers. Repaired hundreds of laptops. And was even a Samsung Authorized mobile device repair technician. I've spent years learning all about how to assemble, install and service all sorts of hardware and software platforms. And I'd say I'm pretty good at it. After years of being a technician I have decided to go back to school and learn more about software development.

"Computers don't make mistakes. What they do they do on purpose."

~ Dale Gribble

"Captain, the computer does not judge. It makes logical selections."

~ Spock

Check out my GITHUB account! There you will find a few projects of mine in HTML/CSS/JavaScript and C# with .NET Framework. You can also find the code for the program demos showcased below.

Program Demos

1 / 3

I've put together a couple of small programs to demonstrate some of the aspects of Object Oriented Programming. This program makes use of JavaScript's canvas element. A single Class Constructor or "blueprint" is used to define the objects. In this case circles. Using variables for X and Y coordinates plus a radius length and fill colour the constructor has all the properties needed to draw a circle of any size and colour anywhere on the canvas.

class constructor

In addition to the object's properties each object has it's own behaviour. One follows the mouse postion and the other changes colour when it detects contact (or collision) with the other object.

How does the object know when a collision has taken place? Why using trigonometry of course. Imagine a right angle triangle being drawn from the centre of one circle to the centre of the other circle.

Illustration of right angles between objects

Since the program has the value for each circle's X and Y coordinates the exact lengths of the triangles horizontal and vertical sides can be easily determined. With that information we can use a simple trigonometry formula to calculate the length of the unknown side. When that length is less than the sum of each circles radius then a collision has occured.

Get distance equation

Give it a try!

Using this simple collision detection formula, or object behaviour, we can program the circles to do more than simply change colour. If we give the circles variables for velocity in the X and Y directions with a little bit more trigonometry the circles can bounce off each other and the sides of the canvas. Check out the NEXT SLIDE.

Collision Detection
2 / 3

Making use of JavaScript's 'requestAnimationFrame' function we can add movement to the program. I've added two more properties to the circles. An X and Y axis velocity. Every time the screen refreshes each circle adds the value of the X and Y velocities to it's X and Y positions then redraws itself. When a circle touches one of the sides the velocity for that axis is reversed. For example a +1 becomes -1.

At the same time each circle will calculate it's distance to every other circle on the canvas. Every time your browser refreshes the screen, usually 60 times per second, every circle will update it's position and check it's distance to all the other circles.

class constructor

When contact with another circle is detected some slightly more advanced trigonometry is used to calculate the resulting direction and velocities.

Using some of these simple concepts combined with a little imagination all sorts of applications or games can be created! Check out the NEXT SLIDE for my game demo!

Collision and Reaction
3 / 3

Like in my simple circle programs this program also uses only one class constructor or blueprint to generate all the objects in the game. From the user player, the enemy targets, projectiles and the stars in the background. Giving different objects different values for their constructor parameters and those objects calling different class functions or "object behaviours" one single class constructor can be used for every object needed in this game

Using the same collision detection formula, along with some event listeners, 'if' statements, a few more functions and a little imagination these concepts can be used to make a neat little space shooter game!

Give it a try! Click on the game image. It will open in a new tab

Game Screen Capture
Complete Computer Game

Contact

Get in Touch!

Questions? Comments? Compliments? Critiques? Looking for a software developer? Feel free to reach out by filling out the contact form. I'd be happy to hear from you!

Name:
Email:
Comment:
Back to top GITHUB

An AlwaysOnCue™ Production

Legal stuff. Copyright©

Made in CANADA🍁