241
Meet and Greet! / Re: REXi
« on: May 09, 2014, 09:49:05 AM »
Welcome to the forums! Thanks for making us a picture of all the common jumps in game maker instead of in paint like these other guys
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Fuck Windows 8.
+ The player object is now destroyed when pressing "R". +
- World Object, Press R Event. [ note: before loadgame script is executed ]
// Destroy Player Object
if instance_exists(player){ with(player){ instance_destroy(); } }
...have been lurking on Twitch...
global.lifeCount = min(floor(abs(real(string_digits(get_string("How many lives?","50"))))),1000000);
The first thing you might be saying is "WTF why so many parentheses dude" and to that I say... blame Paragus for breaking my code return global.lifeCount > 0
This function is just a simple way for you to see if it's sunpossible mode or not - If you never set global.lifeCount, it'll be zero, and we consider that not sunpossible mode.return global.lifeCount - global.death[global.savenum]
This one's pretty simple too; call it to get the number of lives remaining.var tem;
tem = global.lifeCount;
file_bin_write_byte(argument0,floor(tem/10000));
tem -= floor(tem/10000)*10000;
file_bin_write_byte(argument0,floor(tem/100));
tem -= floor(tem/100)*100;
file_bin_write_byte(argument0,tem);
This is a copy of the code from saveGame that saves the player's position. This allows you to save values greater than 255; you can save up to 1,000,000 in fact global.lifeCount = file_bin_read_byte(argument0)*10000;
global.lifeCount += file_bin_read_byte(argument0)*100;
global.lifeCount += file_bin_read_byte(argument0);
This is the reverse of the script above - it rebuilds the life count from the file in the opposite way that we encoded it.sunSaveLives(f);
And that's all you have to do to save your life count to your save file!sunLoadLives(f);
And again, your life count has been loaded from the save file! MAKE SURE you save & load all the values in the same order - Game Maker doesn't know what each value in the file is, it relies on you to load them in the same order you saved them.if (sunIsSunpossibleMode() && (sunGetRemainingLives() <= 0)) {
with (player) instance_destroy();
room_goto(rSunpossibleEnd);
}
This code checks as soon as you load the game (or when you press R after you die) and if it's sunpossible mode and you're out of lives; it sends you to a room to be used as a "permanent game over" room, which I named "rSunpossibleEnd". You could do anything else here, like deleting the save file or whatever, but this is the condition that cheks to see if the player is out of livesif (sunIsSunpossibleMode() && room != rSunpossibleEnd && instance_exists(player)) {
global.death[global.savenum] += 1;
saveDeathTime();
}
This code is optional. It forces the player to lose a life if he's still alive when he presses R - perfect for those m9 traps