Return to Sender

Damn it feels good to be working again. It seems that not only has my time away from this finally come to an end, but my time as a social pariah has also. It’s been a pretty good week really. Good to be here writing this, about this. If I had a horse to ride, I would be riding quite high, both from posture and because I figure the horse would be trojan sized, albeit without all the little Greek dudes hiding inside.

I’m clearly getting off track. My posts seem to be less focused when I’m in a really good mood. When I’m depressed or furious they seem to have more of a point, so I’ll get to the stuff I did. Like the last post said, I went ahead and finished off the ground. It works now like it should and you can bump into it and so on. When I originally set it up I accidentally made all the ground act like a bullet, so enemies would crash into it. It was actually a nice representation of how it will eventually work. In the meantime I made all of the ground part of a different List.
With that finished I began to set up the system that could create different kinds of ground. Basically I wanted a border that would visually mark the boundary of the play areas. In other words I wanted it to be easy for a player to know where they could and couldn’t fly. If you look at almost all side scrolling platforming games the outsides of places you can stand are a different color. If you look here : http://www.videogamecritic.net/images/nes/super_mario_bros__3.jpg you’ll see that the floor does this. It represents a boundary that you cannot pass. The hills behind though you can pass through, so while they have outlines they are not as distinct as the one on the floor.
Anyway, when I coded the ground for Paper Zeppelin I wrote up a long winded function that checked to see what kind of tiles were around the ground that I was making, then created a ground piece with the appropriate number of sides and rotation. So now that works, which is far better than the alternative really. I did have a problem with the rotation though. The computer thought it would be a good idea to not rotate the squares correctly. So for every 90 degrees of rotation (as opposed to every 98 degrees of boy band) it would lose a couple of those degrees. These small changes make the tiles not line up quite right, which left gaps. The technical term for how it looked is “Ass.” To fix that, there are now 2 different pictures for each ground piece that is rotated and when I make them, the system picks one based on the rotation that the system figured that each one should have based on what kinds of ground is around them. It’s much better now.
With that done I made slanted ground work too. I did have a short conversation with myself regarding this type of ground. On the one hand it would make the game much better to look at, since in the final art the “slanted” ground will be represented as rolling hills and knolls (as in the grassy kind, not the other kind). On the other hand, it does make the ground functions work a little harder. Plus they need their own collision system. I decided that having both a corner piece and a hill would help facilitate enemy placement and level design. Basically, I could easily place enemies on the flat pieces much easier.
So the first thing I did was update the ground spawning function to also make slanted ground. Considering the rest of the ground spawning function already worked, it was quite easy. Then I created a collision system that used multiple rectangles to approximate collision with them. The problem is that collision only functions with rectangles. A slanted hill thingy doesn’t fit into anything even resembling a rectangle, which kind of sucks. So I made a trio of rectangles that fit inside the slanted hill thingy, and it works well enough. So now that crap is all oranged.

-Right then. Something that is important to know if you’re reading this is all about a List. A List is how C# and the Paper Engine keep track of objects. Basically, it’s a set of things, and the type of List tells you what kind of things you are tracking. So for example, I have a Sprite List called groundList that is a list of all the ground that has been created so far. When I want to update it, I tell the system to go through everything in that list, find the Update() function in their robot code, and do what it says. Unlike in The Thief’s Tale, I don’t have explicit names for every little thing, so I can do stuff to the groups.
The reason that I keep adding new lists instead of just having everything on the same list of objects, is so I can make them interact in different ways. So I can create a nested code piece that says, “let’s get everything on the ground list and see if any of them are touching anything in the enemy list and the bullet list.” So in the example above, I had added all the ground to the bullet list. However, I also tell the computer to kill any enemy that is touching anything in the bullet list. Since ground was acting as an incredibly slow moving bullet, the enemies bit it when they touched.
I hope that clarifies.

-Alrighty, finally I can get to the titles. I discovered a new way to do something really awesome. It’s called the Return function. Basically, a return function can act as a kind of variable. Let’s say that we had a function that multiplied 2 numbers together like this :

Public Int MultiplicationIsFun(int X, int Y){
int Z = X * Y;
return Z;
}

This would send a value back. I can also create it to see if the number is odd, even or any other maths I can think of. What’s really cool about it is that I can use the whole function in place of the variable that I really need. So I can do this math for example :

2 * MultiplicationIsFun(5,7);

Of I can nest them like this bit of crazyness:

X = MultiplicationIsFun(MultiplicationIsFun(10,5),MultiplicationIsFun(7,MultiplicationIsFun(6,2)
..which would look like this if written normally:
X = (10*5) * (7 * (6*2))

So what? Well, I discovered after this that I can substitute anything that can be returned. So I can fetch a list, or a color or even a player. An example of such is the controller input. It checks to see what a specific controller is doing. It’s pretty swell, but the code is stupid because it looks like this : GetGamePad.One
That’s right. It fuggin says “One.” That means I can’t do anything with it normally. However, I can Return that whole thing with a return function. So what I did was, instead of saying GetGamePad.One, I told it to GetControl(player). The GetControl() function then figures out which player I want (since “player” is a variable I can modify) and send back the right bit of code.
Say I wanted to know what player number 4 was doing. I would ask for GetControl(4) and it would send back up the stream GetGamePad.Four.

Again, one could ask why anybody should give two shites, but here’s the really cute thing though, as of yesterday, all of the players are on their own list and all of the players has a controller that works. I can add any number of players when I want them and they should function correctly. In effect, the skeleton for multiplayer Paper Zeppelin is constructed.

-Today, the plan is to finish off the addition of the multiplayer bits. Mostly old stuff that still assumes that there is only one player in the house. Then I have to add an HP value to everything. One of those old bits is the gun timer. It tracks a distinct value for timing so bullets happen as a certain rate. The alternative (which is what is now happening) is a bullet hose that creates a laser of bullet bills (the placeholder sprite – it seemed appropriate). The problem with that is that I do not have enough variables in my classes to keep track of that number and the player’s HP, so I need to add that value to everything. C# hates it if everything doesn’t match.
Although this addition will allow me to correctly code the enemies in the design document that have more than a single hit point. I also figured that I could create ground that was destructible this way. Not full scale mind you, but a little could spice up the levels a bit. Or I’ll hate it to death. Possibly that.

-Gods, a boy band reference. What is happening to me?

Leave a Reply

Your email address will not be published. Required fields are marked *