Menu

Subtracting lives

2004-11-19
2012-12-25
  • Nobody/Anonymous

    Okay this is making me sort of mad trying to figure this out......In the game I am making I created a special function called "death" that should subtract one life off of the inventory. I go to try it out and it for some odd reason subtracts two lives instead of one. So i tried setting up a collision for the enemy sprites so that as soon as I run out of health it restarts the player sprite and subtracts a life.....and guess what happened it subtracted two instead of one. I have spent quite a few hours trying to figure out what's wrong and I can't seem to find it. it would really be appreciated if someone could possibly give me an idea what is wrong.

    Thanks

     
    • Ed

      Ed - 2004-11-19

      If this is a special function that activates on a sprite collision, make sure that the collision isn't also subtracting a life.  Also, make sure that you have the special function set to change it by "-1" and not anything else.  Also, make sure you aren't activating the function twice (for example, if you are activating it by way of an "Activate Series of special functions" and it is in the list twice)

       
    • Nobody/Anonymous

      Okay i found out what the problem is. I have the map interaction spikes so as soon as the player sprite touches this tile it is teleported back to the beginning of the level. The problem is that I also have a map interaction that as soon as the sprite touches the spikes it subtracts a life. But i have a bunch of these tiles togehter so what happens is the sprite touches two tiles at the same time and subtracts two lives instead of one does anyone know how i can fix this?

       
    • Ed

      Ed - 2004-11-29

      If you instead have one Special function that activates on each touch that activates two other special functions (activate a series of special functions) that would first teleport then subtract a life, that would work better I think.

       
    • Benjamin Marty

      Benjamin Marty - 2004-11-30

      *Pondering* ... Can you have an inventory item called "SingleEffect" with max count = 1.  Make a global function that always adds 1 to the SingleEffect inventory.  Then have the tile interaction use up a "SingleEffect" to activate.  The tile interaction could trigger a special function that performs the changes you want (subtract life and go to the beginning).  This ensures that the tile interaction can only trigger once per frame even if you are touching multiple tiles. It would also allow you to continue using tile interactions without having to put special functions over every area of spikes that you have.

       
    • Nobody/Anonymous

      sonic

       
    • Nobody/Anonymous

      pokemon

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.