Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Lives Help


Mr.S

Recommended Posts

What I normally do is have lives be a Global Value, that way I can track them across multiple levels. So, on the like, title screen, before the first level starts, set the lives Global Value to 3. Then every time Sonic dies, subtract 1 from it. That should work just fine. Obviously, if you want your lives counter to display the current amount of lives, just set the lives counter to the value of the lives Global Value. Hopefully I didn't confuse you =P.

Link to comment
Share on other sites

What GD suggested is a good option. I personally use Associative Array Object to store lives & score value. When the frame starts, I call that object and set the counters according to savefile's settings.

Link to comment
Share on other sites

I believe he's using GM for the game. Gamerdude's method works just fine, just remember to name a value with 'global.' at the beginning of the name so it'll become a global value throughout the game. Then just make sure that the object that has the value is in every room that requires it.

Link to comment
Share on other sites

There's no need to use a global.lives when there's a variable already called "lives" :P

Other important aspects of many games are the score, the health, and the number of lives. Game Maker keeps track of the score in a global variable score and the number of lives in a global variable lives. You can change the score by simply changing the value of this variable. The same applies to health and lives. If lives is larger than 0 and becomes smaller than or equal to 0 the no-more-lives event is performed for all instances. If you don't want to show the score and lives in the caption, set the variable show_score, etc., to false. Also you can change the caption. For more complicated games best display the score yourself.

score The current score.

lives Number of lives.

health The current health (0-100).

show_score Whether to show the score in the window caption.

show_lives Whether to show the number of lives in the window caption.

show_health Whether to show the health in the window caption.

caption_score The caption used for the score.

caption_lives The caption used for the number of lives.

caption_health The caption used for the health.

.

As I said, you're probably chaning the lives variable at the start of the room, do it at the start of the game with a "loading" room instead. That, or when you select "New game".

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...