How to manage having 2 possible ending screens in a game?

Blue Whale 2

  • Posts: 25
Hi, I am currently working on a game project, being a shooter type game. I have a small issue, I would like my player to get some damage from the Enemies before it gets him killed but for now I can only make the win behavior working. I tried my own blocks and also blocks from the forge. For now when my player got hit it just disappears from the screen. I managed to got a Game over before but it does not take into account of damage my player got.

I hope it is clear, I just cannot find the logic in Stencyl to make this outcome possible.

Thanks for your help! Attached I put my last attempt

colburt187

  • *
  • Posts: 2416
Unfortunately I can quite work out what you are asking. You you want your player to have health, and when he its an enemy it reduces his health?

Electric Fruit

  • Posts: 116
Hi

I can see two issues with the code you posed that might stop your game over from triggering.

In the first screenshot i don't think the swith scene block will ever be called as you are killing the actor too early. Try switching the last two blocks around so that the switch scene block runs before the actor is killed.

In the second screenshot the variable "healthmel" will never equal zero as the block right above it is setting it to 20. The update event runs constantly so at the moment you have the following happening every frame of your game:

Set healthmel to 20
If healthmel = 0

In order for healthmel to ever reach 0 you will need to move the Set healthmel block somewhere where it is not running constantly (possibly in the created event).

Hope that helps


Blue Whale 2

  • Posts: 25
Hello ! I tried as you suggested Eletric Fruit but without success. I changed my approach for the game, I want the player to beat its own best score everytime or to lose. For this I coded like in the screenshots. My player dies but it doesn't switch to the end scene. Also the score does not seem to increase when my player shoots enemies succesfully. Any help is welcome :)

colburt187

  • *
  • Posts: 2416
You need to remove the Max Score and Victory counter from the updating event, you are constantly setting them to 0 so they will never increase in value. They will be 0 when the scene loads anyway so no need to set them to 0.