Tuesday, December 25, 2007

Fixed Something I Didn't Even Know Was Broke

So, I started noticing this little thing where the character started out on a tree. It was fine to move, and of course I couldn't move back onto the tree. So I decided to change the starting position of the character. Unfortunately, I noticed that the playerPosX, and playerPosY numbers seemed to dictate where the character would come up on the screen, not in the field. Well, I fixed it. I had to add two variables, ones that measure the initial distance from the original starting point. This makes me realize I shall have to make a method that initializes all the character information when the game is resumed. I know I should have already thought of that, but hey, this is my first serious game, and I'm learning as I go.

So, now my character is centered on the screen no matter where on the board he starts. I was in the middle of getting the sprites for him up and working, so I shall continue that now.

Done

Collision detection is working. It was just a little switch statement using the direction, and whether the tile above, left, right, or below was a one or a zero. I only have two different tiles now. In the future, tiles that the character collides with will be within a predetermined range of numbers. That will be my collision checker.

Alright, Whatever

I ate some more food, and my headache is more or less at the same intensity it was earlier. So, I am going to go ahead and do a little programming. Gotta go up to my bed, and get comfortable first. I discovered that the power button on my tv remote, which I had believed not to be working, actually does. It's a little tricky, but it saves me a naked trip across the cold room, out of the cover of my warm blankets.

I'll have some results later, peoples. It's collision time!

Java, For You Peoples

So, I did a little search for Java in blogs, and didn't come up with anything useful. Then I was searching around Facebook for Java groups, and in one, I found a link to a blog made by someone who was writing a Java tutorial. In the interest of internet friendship, I am going to put a link here so that people can go check it out, if you want to learn Java. So far there are only two posts, two lessons, but if they stick with it, it looks like it could be good. So, enjoy this, and learn, people.

http://toastcode.blogspot.com/

If I see anything on the blog that looks wonky, I will point it out.

I Don't Heart New York

Scratch that, I fucking hate it. I love Philly much more. Why? Well, I respect assholes (this city being full of them, and I myself am one), I don't mind the filth, and frankly, the 400+ murder rate is something of a draw to me. I don't ever want to leave. I also hate traveling with my family. They hate taking me places, too, and have vowed never to do so again. On the plus side, I got to see my sister for the first time since I started college three or so months ago. That was alright.

I have a headache (which set in just before the Indian food, which was the reason I went in the first place. I had the mixed grill tandoori, which was still good, though a little burnt), although it is mostly gone. I am eating some food to help rid myself of it (I tend to not take medicine for stuff unless it's prescribed). But as for Java, no. No programming tonight. Just... no.

Tomorrow, peoples.

Yes

Well, your intrepid programmer has taken ten minutes out of his time, even when he said he was going to be leaving for New York, mind you, to do a little more programming.

I have moved the player to the center of the screen (I made it so that when the drawing section hits the tile that represents where my player is, it leaves the square blank). I have also fixed the screen so that it is centered around the player (it was not, before). Also, since my tiles are 96 pixels in size, they do not stretch completely down to the bottom of my 900 pixel screen. Therefore, there is a small strip at the bottom that shows part of the next couple feet down, and it does not update correctly. I have taken this and covered it with a black bar. In the future, I plan to move the entire screen to the center, and put two small black bars at the top and bottom for more of a widescreen experience.

So now I have a little gray square in the center of my screen. I suppose this can be used to make my collision code before I make the player code. It jumps when I move, because it is not a picture that moves smoothly, but it gets the job done. The player is going to be centered in the screen at all times, turning whichever way you're pointing him, and walking when you walk (runs when you run, fishes, etc.). So that will solve that glaring thing.

I leave in about forty five minutes. I do not think I shall endeavor to program any more until sometime after I get back. I gotta check my Facebook and stuff.

Tired

Well, it is roughly one hour before my little family sojourn to New York. I have been tinkering with my program for the better part of an hour now, and I have some good stuff to report.

I have fixed my camera (what I call the chunk of code that shows only the tiles around the player). Before, it went through every tile, and used an if() statement to determine if the tile was able to be shown. This was fine for my test grid of twenty by twenty. But, the actual maps are going to be a fair share larger than twenty squared. This game is going to be a free roam game, unlike the other linear Pokemon games. The grids are going to be very large. So I have changed my camera so that instead of running through the entire grid, it now targets only the area around the player. Actually, there's still one aspect I can't get my head around, but it works, so I think I'm alright.

Now, it gets a little buggy when I go out of bounds, but in the actual game, I will be doing what they did in the other Pokemon games: there will be a ring of trees around the borders of the map that will extend slightly beyond the screen. That way, when you hit the edge, there's no trouble caused by trying to index out of the known array.

Collision detection, that is next. Well, actually, I want to insert the player in there first, so that I know when I should be colliding with stuff. So, the player goes in, and then I start colliding with stuff.

But alas, first I must travel to a land just to the north of Pennsylvania. I must go to New York to visit my sister and eat Indian food (no, I'm not Indian, but they make damn fine food). Programming later. And in my head while I'm there.