Posted on

Bouncing ball with collision detection

Self Portrait 1989 charcoal and white conte crayon

The drawing above is a self portrait done so long ago I can’t even remember the year. I have dark hair, so it was probably during my twenties or thirties.

I used to program games in flash that had rockets flying in space. They had motors that fired, directional thrusters, variable velocity, collision detection, gravity, friction and bounce. But flash is dead…or at least it doesn’t work on phones, and I like to make things that work on phones.

Now I’ve just finished another excellent lesson at https://developer.mozilla.org It was an applied application of OOP as it is used in JavaScript. It didn’t make a rocket, but it did make a bunch of balls that change colors when they collide. I added in a drop list that lets you change the number of balls. I got it to show up here in wordpress via the shortcoder plugin.

Here is the code if you are curious: https://codepen.io/markhwebster/pen/VQzyJM

Leave a Reply

Your email address will not be published. Required fields are marked *