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 in a pattern. Sure, straight lines are pretty easy. But games get really boring if… Read more »
Posts Tagged: Math for Games
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 hole the higher the score. Either way, you need to know the distance. The Math… Read more »
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 you took trigonometry or pre-calculus and were introduced to a radian. A radian does the… Read more »
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 sum of the squares of the two legs is equal to the square of the… Read more »
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 that there are two copies of the same image scrolling from the right to left…. Read more »
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.
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 graphic that scrolls as Mario moves through the world. What we want is a scrolling… Read more »
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().
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 to position symbols in a grid. That’s what we’ll create here using ActionScript 3. Demo… Read more »
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 the image and parsed through the binary code to get the dimensions. Yes, there’s an… Read more »