re:Creation week #4. New graphics, chests, doors, screen transitions

Previous weeks:

This week was totally awesome!
Dmitry has redrawn lots of graphics and the game looks a lot better now.
We’ve also decided to make character proportions more realistic which is also great.
Here’s the graphics comparison

I’ve also made invetory system and inventory menu.

It was pretty easy to implement. I created InventoryComponent which has std::vector<std::string> of item names. When drawing inventory, I get all the important info about the items from scripts by item name. Giving items to player is also easy, it’s just one line in script!

addToInventory(playerId, "DUCK")

Checking if player has item is also easy:

hasItem(playerId, "DUCK")

This function can be called in script so I can check this when player interacts with npcs. Something like that:

-- something in .lua script
if(hasItem(playerId, "DUCK") then
    say("Where did you get that duck"?)
end

I’ve also made chests.

Chest actually has three states: closed, opening and open
Opening state is important because I can show the item which player gets and then I call “open” function from script which gives some item to player and sets chest in “open” state. It’s also important when loading saved files. I need to set all opened chest states to “open” so player doesn’t get another item or hear opening sound.

Doors are very similar to chests but they have a neat feature which chests don’t. Doors can be automatically opened on some conditions. As you may see in the .gif above, the door opens when player kills the enemy. How does it work? Pretty easy. I have “isOpened” function in script which is called every frame. Something like that:

isOpened = function()
    if(killedEveryone()) then
        return true
    end
end


When it returns true, the door goes to “Opening” state and opens.
I was worried that this will slow down the game but it’s actually working pretty fast and the game runs normally.

I’ve also made neat transition effects when player goes to another level.

 

Thanks to guys from SFML forum who helped me achieve this (SFML already had pixelation shader so I didn’t need to write it from scratch)

And that’s all for that week. There’s not a lot left to implement to make a fully playable level! I think it will be ready by the end of this month and I will release the build to hear what people will say about the game. (I’ll probably get lots of critique, but that’s great if it’s constuctive!)

10 thoughts on “re:Creation week #4. New graphics, chests, doors, screen transitions

Leave a comment