Tag Archives: Math for Games

Moving Enemies with Waypoints

Getting enemies to move tends to be one of the more difficult things for me to get right. It just doesn't always seem natural. And I'm not talking about moving with any type of AI. Just moving around the screen … Continue reading

Posted in Coding | Tagged , , , | Leave a comment

Distance Formulas

It's a pretty common task to get the distance between 2 points. Maybe you're wanting to see if two points are close enough to have collided. Maybe you're making a golf game and the closer the ball is to the … Continue reading

Converting between degrees and radians

There are two ways to measure angles. You probably learned to measure angles in degrees early in school. A circle has 360 degrees, a perfect corner is a 90 degree angle, and 180 degrees forms a straight line. But then … Continue reading

Posted in Coding | Tagged , , , , | Leave a comment

Pythagorean Theorem

At first glance the Pythagorean Theorem doesn't appear to relate to game development. But we'll see in a bit that it does. First though, let's cover a bit of math. The Pythagorean Theorem states that for any right triangle, the … Continue reading

Posted in Coding | Tagged , | Leave a comment

Create a Scrolling Background in Java

Creating the next great side scroller? Well, you'll need a scrolling background. And if you're programming in Java, here's an easy way to do it. Quick Demo Here's a little demo of what we're going to create. What's happening is … Continue reading

Posted in Coding | Tagged , | Leave a comment

Scrolling background with Python

This is a follow up to an earlier post where we created a scrolling background in Flash using ActionScript. This time we're going to do the same thing, but using Python and Pygame.

Posted in Coding | Tagged , , | Leave a comment

Scrolling Background with ActionScript

Take a look at your favorite game. Odds are good that there is a scrolling background of some type. Think Super Mario Brothers. Mario is a bit different than what we're after though. The background in Mario is a single … Continue reading

Posted in Coding | Tagged , , | Leave a comment

How to get image dimensions in Python

Thanks to Pygame, there's a quick and easy method to get the dimensions of an image. You just have to load it into a Surface and use the Surface methods get_height() and get_width().

Posted in Coding | Tagged , , | Leave a comment

Dragging symbols in a grid with ActionScript

Some games, I'm thinking tower defense, need to give the player the ability to drag symbols around. But you don't always want to give the player free reign to drag it anywhere. Maybe you want them to only be able … Continue reading

Posted in Coding | Tagged , , | Leave a comment

Get image dimensions in Java

Earlier this week I Googled for how to find the dimensions of an image using Java, and most of the solutions were way more complicated than they needed to be. Most of what I came across was code that opened … Continue reading

Posted in Coding | Tagged , , | Leave a comment