Damage, Damage, Damage
|
Hi today i am going to talk about what i did this week. So this week i had to fix a big thing in our project. It is the F##))¤=) damage state of our planet. So i went a little bit crazy because not everything wanted to work like i wanted to but in the end ”everything” worked out just fine. So at the start we had already our normal sprites that we implemented for our planet. Now when the aliens are ”landing”on our planet i needed to give the planet life’s so we actually could get to the damaged states. The problem is that we have four sectors on our planet and everyone has to take damage . For every sector we have , there is another sprite and for every sprite we have there is another sprite which looks like it is damaged. And in the end there is the sector destroyed sprite so if one of the sectors life is equal to zero the program is going to show the sector damaged sprite. So the first thing i had to do is to give the player / the planet a maximum life state so the program knows what the overall health is. Then i had to make an funktion that takes that max. life’s and divide it with four so every sector has some kind of life. i put the overall life to 40 so every sector has 10 life’s. All aliens are making the same damage when they get to the planet right know ,that maybe changes later. Now i had to write an if sentens for every sector that checks every time when the planet / the player gets hit by an alien ship it would take away on life at the same time when the sectors life reaches 35% of the normal health it shows the new damaged sprite for that sector.And when the health of the sector reaches zero it shows the sector destroyed sprite.So i made one ,if sentence ,for every sector so it would inherit the same settings everywhere.I put all the sprites inside my sector class where i load in every sprite for the different sectors and damaged sectors and create them later inside of my if sentens. We’re about to make a damage system for our enemy’s and our planet right now,so it will be more balanced game play, so when that system is finished i can adjust our rules for our planets/players health. Well have a nice day …
|
