Wrote a Tile system!

Welcome back! I’m very happy to be working on the game again, after the brief hiatus. I made a grid system, as shown below. Here’s the latest thing little app I made, the colors and text is all just there for making the tiles visible, otherwise it’d be a blank screen :

Hit the jump for code examples, and what my old broken version of the code was.

Continue reading

Popup Box

Today, I’ve created a popup dialog that will be used to display information to the player. It’s nothing to look at, but I feel like it’s important to get right, since the player will be spend a lot of their non-active gameplay time reading them, and it the popups don’t look right, then the game won’t feel as well put together as it otherwise might. I figure I’ll add an option to slowly scale it smaller and smaller, and also fadeout, just so I can broaden its use throughout my code. Once I get the scaling set, I can also start to implement damage numbers, because I once swore to myself that my game would have numbers everywhere.

In fact, this is a good time to mention that my game will have a stupid amount of stat tracking. Like everything possible will be tracked, and hopefully exported to xml or something so you can browse it yourself. I’m talking like amount of times you pressed a given key, or hit or missed something, or the average amount of experience you’ve earned in the first 5 minutes of the game. Little things like that, things that no one really thinks about, but I’m sure there’ll be one fan that is all about stats, and he’ll love it. I don’t know if it’ll drain the memory though, Python’s pretty slow already.

Hit the jump for an explanation of how I wrote my word wrapping , autosizing popup box.

Continue reading

Added Graphics!

I’ve recently made some progress for my shooter game! I’ve found the equation I’ve needed to find the point where the slope of the direction crosses the boundaries of the rect for the players, with the intention of having a good starting point for bullets to spawn from. It’s also a great way to determine all the points in the perimeter, obviously. But anyways, here’s the code:

def sign(x):
    """returns the sign of x: -1, 0, or 1"""

    return cmp(x, 0)

def intersect_perimeter(x, y, w, h):
     """finds the intersection in a rectangle"""

     #if check which side to put the point on
     if abs(y*w) > abs(x*h):
         return (int(0.5*h * x/abs(y)), int(0.5*h * sin(y)))
         return (int(0.5*w * sin(x)), int(0.5*w * y/abs(x)))

I’ve also had the chance to implement some cheap graphics, including bullets, explosions, and a house, drawn by me, but also a background image, drawn by the most angry of my friends. The results are pretty nice, definitely an improvement over the old off-white background. You can see the player, flames behind him, the place holder house, and the background

Continue reading

Quick Update

I drew some flames, and posted to /r/gamedev, so I figured I’d mirror it here


Just added some flames to the dudes. It’s gonna be a topdown shooter ala Geometry Wars and Gatling Gears.

This week I’m going to try to add a background, put shooting back in and scoring.


In related news, I’ve made the game redraw and reload the sprites every frame, which comes out to about 60 times a second, if that’s not a drain on performance, I don’t know what it. Luckily, or perhaps not, my PC is tougher than my 4 year old laptop, so it’s taking the load happily.

I’m going to rewrite the shooting this week, like I mentioned, but I’d really like to add seeker missiles, but I’m not quite sure yet how to make the missiles turn gradually. I don’t think it will be that tough, just rotate the sprite a bit every time and adjust the speed, but I’m going to have to take a look at the trig math behind it to choose a function that gradually speeds up and slows down.

Anyways, hopefully I’ll have the time to write a more full post later.

Pygame Rotation Tutorial

Hey there,

So what I was recently having some trouble with was with Python’s PyGame Rotate function. I was having trouble understanding what some of from the comments found here meant, or were trying to illustrate, let alone the documentation given, so I resolved to figure it out , once and for all, so hopefully this post will be enough to get someone else on track. I think I was getting caught up on the different ways to deal with blitting and surfaces and rects.

Continue reading