Members Only

So it turns out I was both correct and wrong in equal measure regarding the previous posts. First of all, it turns out that whether or not I can access information has nothing, nada, zero to do with whether or not the information I’m looking for is somehow abstract. It turns out, that I had done something stupid. You see, when I originally set up my Arch Sprite Class – the one that contains all the little details about how the sprites themselves will function – I had followed what online tutorials said I should, which is to mark the class variables as “Private.”
I’ll start over so we can all keep up. Classes, like I’ve mentioned before, are just like little robots. I can make a new on and it’ll follow the instructions I gave it. The Sprite Class is a big Class that all the little Sprites are connected to. So the player pictures, and the enemies, and bullets and all of that are all sprites. Instead of giving all of them the specific instructions for how they are drawn and the logic that controls all of that, they instead are all the little childrens of the Sprite Class proper, and that Sprite Class controls all of their display logic and stuff for them.
That big Sprite Class also defines all the bits that the little Classes are made of. So their positions, and their speed, and what picture they use, and all of the other silly things (like how big their pictures are). Those are the variables that I’m talking about. They can be marked as either “Private” which means that only the Class that the variable belongs to can use (or access) that variable. “Public” means that anything can get the information as long as I can be specific enough. “Internal” means that the information can be shared inside the Class Family. So an internal variable could be seen by both the player class and the enemy class if I wanted it to be.
My problem, was that I had made the position of the different things a Private matter. I told the computer that it wasn’t anybody else’s business and they should stay out of it. Now I’ve told it that it’s okay to gossip a little. Share the knowledge really.
Long story short, I can get to any of the data anywhere as long as it’s a sprite. This new access to my own bullshit has allows progress to advance quickly. So after a fashion, like the start said, I was correct in a previous assumption – the data is all organized like a bunch of little tables, and I can get to it if I want.
What I don’t understand, is why the ability to make a variable Private is event there in the first bloody place. Unless it’s a variable that controls something inside a function I don’t see why you wouldn’t want to be access that information wherever it is convenient. It may be faster somehow when the program is running, but I’m finding the access is making things far easier to implement.
Ah right, what do I mean by “inside a function?” Say you want the computer to do something ten times. So you would create a counter inside a function. Every time the function does something, you’d increase that counter by one. When the counter is at 11, you would make the function stop. That counter would be “inside” the function. It’s a made up number that doesn’t exist anywhere else, because it doesn’t need to. The next time the function comes around, we’ll make a new counter number. Contrast that to say, the player’s life total. That’s important information that we would need to remember.
Yay! Technical!

Speaking of silly other crap, I went ahead and built a new way to see if things are touching. I already had a way, but it required that something be there. So I could see if bullets hit enemies or things were crashing into the player, but I had now way of knowing if something was touching an area with nothing it it. So I built a function that compares two sets of points. It checks to see if the first four points are inside the area of the other four. It works pretty well actually. Try as I might, I couldn’t make it really perfect, but then I remembered I don’t need to. These areas are really just for AI, and they work great in that capacity. So now I have enemies that dive on the player if the player happens to be in the target area below them.

In all, now my software works. There are no bugs that I can see, and the whole thing is spinning along nicely. The basic backbone of the thing is constructed, and now I can hang the rest of the elements on like little tree ornaments.

-Yes, I know. This is like, the 7th technical post in a row. If I got letters (from readers – HA!) they would probably say things like, “Um, you ramble too damn much and we don’t know what you’re talking about sometimes.” Or “Get back to talking about design and making stuff fun.” Maybe “Oh, and the kitten punting thing. You haven’t mentioned that in like, forever.”
Sorry boys and / or girls, but that’s the second, cool part. I mean, you don’t start off playing in front of thousands, you have to put the time in to learn power chords and rockstar slides first. Besides, you’d be surprised how much of game development is this.
Oh, and I feel smart sharing my victories. It’s slightly better than ranting against my shortcomings, even if it’s less interesting to read.

– Oh, and CID still doesn’t condone the punting of kittens. Even if they deserve it. Little Brutes.

Leave a Reply

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