Oracle’s Eye Development Small Update

I don’t have anything really newsworthy to share since last time, but I thought I should update the blog on my Oracle’s Eye progress.

I had a stick figure that would glide around, and three others that would move at different speeds and in different directions relative to the one you control. The Player objects were hardcoded into the PlayState as global variables, and I named the variables gTemp_player to remind myself that these are meant to be temporary.

I decided that I needed to create a GameWorld class to handle all of the entities and their interactions. I set out to design the class, and I found that it would have to own the Room and the Player. It makes it very easy to have a GameWorld class that determines how they interact because otherwise the PlayState would know too much and it would add way too much complexity. The cool thing is that keypresses can be handled by delegating to the GameWorld object. For instance, if I press the left arrow key, PlayState will simply tell the GameWorld to moveLeft(). The GameWorld can decide what it means for it to move to the left, but it will likely just move the Player object in that direction.

Great. Now I just need a Room class…and a Room class needs a Tile class. I already know that I want different types of tiles, so I created FloorTile and WallTile classes that derive from a base Tile class.

In the end, I created all of these classes, but there wasn’t enough time in the development session to actually get them all to work together. I’m still hardcoding PlayState, which is fine for now. Since I can’t just create a Room with Tiles easily and I want to see the tile sprites, I just used a Player object that won’t move and used the tile sprites as the sprite for the image.

It actually didn’t look too bad:

Technically all of the extra code didn’t actually do much to change what someone would see when you run the program, but I think the foundation is ready for me to make significant progress. Tonight is another scheduled night to work on it, so it will still be fresh in my mind.

My next step will be to transfer functionality from PlayState to the GameWorld class. I will then attempt to force the Player to walk only within the boundaries of a Room, probably by just having GameWorld check if Player’s position would intersect with WallTiles. FloorTiles will be in the background, and Kyra makes it easy to check only the sprites I need.

Comments are closed.