So now, when killing a monster, they have a probability to drop one item (coin, ammo). The randomness is quite simple in this first implementation but i will polish this later because for example, i need to be sure that if some ammo are dropped, that the player has the right weapon for this type of ammo.
As i said later, i prefer to implement now the basis and polish everything later.
Next step? Changing map with a door or a stair! But i know this will require lot more work that the last things i have shown.
I am progressing a lot these days in my Cthulhu game.
After implementing items drop, i added the code to manage ammo for shotgun, displaying it in the weapon bar, peeking ammo on the floor, decreasing ammo when shooting monsters, and running out of ammo with the shotgun. The font used to display it (the same as gold) is not perfect but this will do the job for the moment. Too many times i have focused on details but i think that i need to make progress on high level mechanisms and not trying to make everything perfect. This will be polished later.
My next goal is to implement dropping items from dead monsters.
So now i am able to drop items on the floor, i have implemented to pick them.
Next step: pick ammo on the floor, manage ammo when shooting etc
So it took me lot of time to implement ranged attacks in the game. Mostly because it was difficult for me to work on the game. I have refactored a lot of things: the attack system was too much “close attacks” oriented and i just want only one attack system in the game.
I have also modified the rendering because there is a sprite for the bullet to handle with other sprites like hero or monsters.
The collision system i used for wall works great for bullet hits so this part was easy.
Indeed the most difficult things was to debug the code because it is not really possible to use unit tests to check each logic parts. I have implemented a feature to slow down the game speed in order to debug it like a step by step process in the real game.
The next step i have already started is item drop like coin and ammo.
to be continued !