Space Giraffa – Update 6

During this week I have made a checkpoint manager class and checkpoint objects. When the player finish an enemy wave a checkpoint appears from the right side on the screen and drift past the player. When the player see this checkpoint (that will look like a bear holding a sign) they’ll know that they can jump to this point in the game through the level select screen.

I made some changes in the enemy manager class so that any observing instance can change the level file during run-time, hence made it possible to jump to any enemy wave. Previously we had every enemy wave stored in one level file. But had to change it because it is much easier to start at a specific wave when using separate files than looking for a position in one file

So this is how it’s supposed to work: When there are no alive enemies left from one file, the checkpoint manager spawn a checkpoint. When the player avatar passes the checkpoint it disappears and the next level file is loaded. This happens until the last wave and the last checkpoint triggers the enemy manager to spawn the boss. When the boss is defeated one last call to the checkpoint manager is done and the game state proceeds to the victory screen.

checkddd

I don’t actually know if it work because I have just implemented it. But according to my calculations it should work. Maybe. There is some features that my version of the source code do not have and I have to implement it until I can make sure my checkpoint feature work like it should.

Since this is the last day our group can work on the project, I have been working hard on getting the last things that was left implemented. One of them was cave obstacle that would act as a tutorial region. Because the cave walls only bounces the player back, its only purpose is to teach the player about collision and how big the collision box is. By doing it this way the player don’t have to figure it out by colliding with the enemies later in the game.

After the player have passed the cave obstacle, it will also get a checkpoint so the player don’t have to player it again.

I’m going to get back to my coding so, have a good one ♥!

Space Giraffa – Update 6

Space Giraffa – Update 5

Other than recovering from Monday’s beta presentation, this week has been pretty mild. I have chosen some easier tasks to complete for this scrum session. One of them was a High score system that can add entries and sort them with the previous score entries which are loaded from a save file.

First of all, I created a struct called “Entry” that contains an integer and a string data type. The integer stores the users’ score and the string stores the name associated with that score. This makes it easier to keep track of the name while sorting the scores. By including the “algorithm” header I have access to the sort function. Algorithm’s sort function can sort a vector array by comparing any value from two elements using a self defined binary function. Something like this:

struct SortFunction {

          bool operator() (int I, int J) { return (I < J); }

};

The function don’t have to be imbedded in a struct.

The class’ constructor opens a text file and imports every previous score and its name and adds it to a vector array. Later when a user wants to submit their score to the high score table a function will do that for them.

This function first checks whether the user’s name already exists somewhere on the high score table.

If they do, the entry’s score is changed. But is it doesn’t exist, a new entry is created containing the score and the user’s name and placed in the vector array.

When that is done the array is sorted using a special binary function that compares two entry objects by their integer value.

bubbl

The score system class can also retrieve names and scores from a desired place in the array. This feature is only going to be used when drawing the score board.

Our game’s main protagonist “Giraffa” has felt very stiff when flying around in space. We wanted to add something more to the player avatar to make it feel more dynamic. The biggest request has been to make the giraffe’s legs flail as the she moves. This will add to a more comic aesthetic to the player avatar. I am currently working on this visual feature and have written down some pseudo code to help me find a good solution. I’ll either simulate some simple rope physics or just rotate the lags by the amount of horizontal speed but this is one of the things I link with programming.

Now I have to get back to my coding, so have a good one!

Space Giraffa – Update 5

Code review of Mermaid River

In the game Mermaid River the class called “Captain” is represented as the playable avatar in the game. An object pointer of captain is stored as a private member in a derived class called “GameState”. When the game state’s “Enter” function is executed, the captain gets a struct filled with pointers to different objects like draw manager, state manager, mouse, etc. But all of the instances weren’t used like the state manager. They could have send only the useful modules to captain instead.

The captain object is updated inside an if statement when game state is updated. But captain’s update function takes a copy of a harpoon object which is provided by game state by dereferencing a harpoon pointer. But this copy only serves a small purpose inside the function by telling its windup time to the captain. This copying could be avoided by only sending that necessary value to the captain directly. But if they need more data from harpoon, captain could instead take a const(for safety) reference. The harpoon class is pretty big and has a lot of variables that needs to be copied and less RAM is used when passing a reference through a parameter.

Very quick recap:

The player object aka Captain has a very loose coupling but it also has some unused instances lying around. The latter is not a big deal.

~Adrian Lavrell

Code review of Mermaid River

Space Giraffa – Update 4

This week I’ve been working hard on the beta stage on our group’s game Space Giraffa. There have been many late nights of hard labor. If it wasn’t for our unfortunate code mishap, and had to rebuild much of our code, we wouldn’t have to stress in order to get everything implemented till dead-line. But as long as we don’t encounter any problems with our current code structure we might have a chance to get everything done. Yay? Otherwise we have to be satisfied with only the vital features.

But at least one good thing happened this week. I was done with all my work from our groups sprint planning so I took about an hour and a half and built an easy level maker for our game. We use text files to store every level and it was difficult to add enemies to file. Not only was it hard but we programmers only knew how to make one. And because we programmers have to work on the game, and the graphic artists did not have much to do, my conclusion was to assign that work for them. Which is now made possible with my “level-creating-tool”.

Level_ede

This is how my level maker looks like. The enemies are represented as colorful dots that stores information in them. Information like velocity and position. The user can move each of the sliders to adjust the horizontal and vertical movement of an entity. That black area is a smaller version of the game window and every entity’s position gets scaled to fit inside the tool’s smaller window. When the user decides to save a level to be used in the game, the tool internally calculates where each entity should be positioned on the screen.

The “Edit Button” gives the user the ability to move and replace an entity with the mouse without creating a new entity. When edit mode is turned off, the mouse can only add and delete entities.

Because we programmers have to focus on getting every feature implemented, I created this tool to make it easier for the graphic artists to help out with level design. It also makes the process A LOT quicker.

That was every thing from me and now I have to get back to programming again so may the force be with you!

Space Giraffa – Update 4