DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for A plushy controlled game (Part 1)
Tom Cools
Tom Cools

Posted on • Originally published at tomcools.be on

A plushy controlled game (Part 1)

I have been fascinated by video games ever since I saw the first level of Mario. They dominated a big part of my youth and are what got me into programming in the first place. Building a website for our Call of Duty clan was probably one of the first times I came into contact with HTML and CSS.

Recently however, my fascination has shifted from playing games, to discovering how they are built. Physics are a big part of what makes a game feel natural, making things fall with gravity, being blown away by wind, etc.
I had no idea how to even start coding physics, until colleague of mine told me about this great book he had read: The Nature of Code.
The book describes in incredible detail how you could program physics in a pretty clear and straightforward way.
Best of all, you can find it online, for free! :o

Next to the physics part, how your audience interacts with your game determines a lot of the experience.
I have always loved the idea of using a camera to control your game so I decided I wanted to use my laptop camera as the main way to interact with the game.

What are we building?

So what do you get when you mix physics and computer vision? A demo concept "game" controlled by a plush animal! So fluffy! <3

In this first post we will focus on the basic elements of a game.
We'll cover how to draw items on a canvas and program in some realistic looking physics. As this blog post contains a lot of examples with Javascript which could not be posted on dev.to, please read the blog on my own personal website.

Top comments (0)

In defense of the modern web

I expect I'll annoy everyone with this post: the anti-JavaScript crusaders, justly aghast at how much of the stuff we slather onto modern websites; the people arguing the web is a broken platform for interactive applications anyway and we should start over;

React users; the old guard with their artisanal JS and hand authored HTML; and Tom MacWright, someone I've admired from afar since I first became aware of his work on Mapbox many years ago. But I guess that's the price of having opinions.