If you’ve made any sort of game odds are you have some sort of artificial intelligence. Think about the old MegaMan games or Super Mario Bros. Sure, the enemies only move left and right, maybe they pop up, maybe they shoot something. That’s been good enough for indie game makers, AAA titles and those of us who play them. Few, if any, games have tried to implement what scientists would consider artificial intelligence or machine learning.
Trigonometry is a tool for animation and of great general utility. With it, you can make a character glow, rotate an image, find the distance between objects and determine whether two objects have collided. It took me a long time to wrap my head around trigonometry. It really isn’t that difficult and once you understand what you can do with it, it becomes a tool in your toolbox you will constantly use.
See the Pen Animating Attributes Using Trigonometry by bitbrainresearch (@jcaldw11) on CodePen.0
This is a clock. Or rather, it’s three clocks. The first is a typical analog clock on the top left, a digital style clock on the top right and on the bottom is a number line clock.
What the heck is a number line clock? Well, good question. I was talking to my sister-in-law about my number line post and she suggested that third grade students had to learn the relationship between a typical analog clock and the number line. So that’s what I’m working on now. Showing that relationship.
The codepen itself also demonstrates using trigonometry to control the apparent (but not real) rotation of the clock hands. They are actually just lines drawn to the correct point on the clock.
It is a work in progress and I hope to make some upgrades soon.
I remember when Super Mario Brothers first came out. My cousin was the first person I knew of who had a Nintendo Entertainment System. He had Super Mario Brothers (SMB) and The Legend of Zelda (Zelda). Both games used scrolling but in different ways. SMB had a scrolling background which moved left or right when you moved Mario or Luigi. Zelda, on the other hand, scrolled the screen only when you moved from one screen to the next.
When I was working as a programmer for a community college, there was a day when some kids came in to visit. I got the chance to talk to one of them and he was asking about games and how to make them. We got onto the subject of math and how important it is to games. I tried to explain movement to him but I had to start somewhere and that’s the coordinate system. Trying to come up with a way to explain it I decided to go with something everyone out of kindergarten should be familiar with, the number line. When we make 2D games we use a coordinate system which is essentially two number lines which cross each other. The number line is our playground. For 3D games, there’s three number lines and that’s really the main difference.