Mr.S Posted June 17, 2006 Report Share Posted June 17, 2006 Ok i just added a life system to my game but when sonic dies and the room restarts the life hud goes back to 3. How can is top my life hud from restarting ? Link to comment Share on other sites More sharing options...
Damizean Posted June 17, 2006 Report Share Posted June 17, 2006 That's probably because you set the lifes at the start of that room. Better set the lives at the start of the game (generally there's a "configuration room" at the start of the game) Link to comment Share on other sites More sharing options...
Gamerdude Posted June 17, 2006 Report Share Posted June 17, 2006 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 More sharing options...
PkR Posted June 17, 2006 Report Share Posted June 17, 2006 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 More sharing options...
LarkSS Posted June 17, 2006 Report Share Posted June 17, 2006 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 More sharing options...
Mr.S Posted June 17, 2006 Author Report Share Posted June 17, 2006 Hmm so how can i set this up in Game Maker. Im going try giving the life system its own hud what else can i try. Link to comment Share on other sites More sharing options...
Gamerdude Posted June 17, 2006 Report Share Posted June 17, 2006 Oh, I was unaware that you were using Gamemaker. I don't have much experience at all with it, but as LarkSS said, you should be able to make a value global by putting 'global.' in front of a value name...so you could make like 'global.lives' Link to comment Share on other sites More sharing options...
Damizean Posted June 17, 2006 Report Share Posted June 17, 2006 There's no need to use a global.lives when there's a variable already called "lives" 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 More sharing options...
LarkSS Posted June 17, 2006 Report Share Posted June 17, 2006 Lol, I'm pretty unexperience with GM as well and I didn't know there was a lives variable. =P Is that just for 6.0 or 5.0 too? Anyway, I think Damizean's method is best. Link to comment Share on other sites More sharing options...
Mr.S Posted June 17, 2006 Author Report Share Posted June 17, 2006 Sorry i misread my fault i got it working now. Thanks guys Link to comment Share on other sites More sharing options...
Andrew Posted June 18, 2006 Report Share Posted June 18, 2006 Just a little note: renaming a BMP to PNG doesn't convert it to a PNG. Use Photoshop or Irfanview or something to change graphics formats. Link to comment Share on other sites More sharing options...
revolutiongames2004 Posted June 30, 2006 Report Share Posted June 30, 2006 ya know what would be a lot easier? click add event, other, game start, define it there, that way you dont need to define it in a different room if you dont want Link to comment Share on other sites More sharing options...
Recommended Posts