<undefined> 0 -1 -50 -1 <undefined> <undefined> 1 603 7 0 0 -1 2 self 0 0 1 ///Don't make duplicate controllers if(instance_number(Controller) > 1) { instance_destroy(); } // Don't allow game jolt to be initialized many times initGameJolt = true; 1 603 7 0 0 -1 2 self 0 0 1 ///Restart the game after the end audio_stop_all(); event_perform(ev_other, ev_game_start); //Clear values room_goto(rSetup); 1 603 7 0 0 -1 2 self 0 0 1 ///Change backgrounds and tilesets if(room == rWhite) { if(GameJolt && useGameJolt) { gj_trophy_add("11575"); } image_blend = c_white; background_color = c_white; } if(GameJolt && useGameJolt) { switch(coltonum(image_blend)) { case BLACK: gj_trophy_add("11569"); break; case RED: gj_trophy_add("11570"); break; case GREEN: gj_trophy_add("11571"); break; case BLUE: gj_trophy_add("11572"); break; case YELLOW: gj_trophy_add("11573"); break; case BROWN: gj_trophy_add("11574"); break; } } background_color = image_blend; if(coltonum(image_blend) != noone && coltonum(image_blend) != 100) { colours[coltonum(image_blend)] = true; } else if(coltonum(image_blend) == 100) { if(room == rPit || room == rCavern || room == rCavernExit || room == rSecretPassage || room == rCave) { background_color = c_dkgray; } else if(room == rHouse) { background_color = make_color_rgb(255, 204, 153); } else { background_color = image_blend; } } if(instance_exists(ColorLimit)) { ColorLimit.colours[coltonum(image_blend)] = true; } set_tiles(); 1 603 7 0 0 -1 2 self 0 0 1 ///Choose message based on state and room and stuff var prevMsg = msg; if(room == rGreenStart || room == rValley) { switch(state[2]) { case S_BEGIN: msg = "This is a nice valley. Maybe there is a colour down there."; break; case S_GREENFALL: msg = "Falling again...\nYay."; break; case S_VALLEYBOTTOM: if(room == rGreenStart) { msg = "I hope this is the bottom..."; } else { msg = "I think I see a spark on that ledge. How do I get up there?"; } break; case S_TORCHES: if(room == rValley) { if(colours[GREEN]) { msg = "Ahh. Good to have this one back. I like green a lot."; } else { msg = "That is very cool. I wonder how it works.\nAnd now I can reach the ledge!"; } } else { msg = "It's a long way back up... I'd best get going."; } break; case S_VALLEYOUT: msg = "Finally made it. That was a lot of work...\nBut for the green it was worth it."; break; } } else if(room == rYellowStart || room == rFarmHouse) { switch(state[1]) { case S_BEGIN: msg = "That looks like an orchard! I wonder if the farmer is nearby.\nHe might know where to find a colour."; break; case S_FARMER: if(!colours[RED] || !colours[GREEN] || !colours[BROWN]) { msg = '"You there! My apple trees have gone all white. Help me fix them!\nMaybe I will give you something..." - The Farmer'; } else { msg = '"The colours have returned to the trees! Whoever did this\ncome speak to me" - The Farmer'; } break; case S_HAPPYFARMER: if(room == rFarmHouse) { msg = "I wonder what he has in here for me. I hope it's good!"; } else { msg = '"Was it you who fixed the trees? Go inside,\nI have something there for you." - The Farmer'; } break; case S_FARMERYELLOW: if(room == rFarmHouse) { msg = "Wow. He has yellow in his barn! It's still so bright..."; } else { msg = '"Thank you very much for fixing the trees. You have saved my orchard!"\n- The Farmer'; } break; } } else if(room == rBrownStart || room == rBrownFind || room == rBrownOut) { switch(state[3]) { case S_BEGIN: if(room == rBrownStart) { if(colours[BROWN]) { msg = "Now to get back out. It must have something to do with the boxes."; } else { msg = "An underwater cave... It's very damp in here.\nI wonder what colour might be down there."; } } else if(room == rBrownFind) { if(colours[BROWN]) { msg = "Oh. That box is floating. I guess brown weighs less?"; } else { msg = "I see it over there. The brown.\nI wonder what it does."; } } else if(room = rBrownOut) { msg = "I haven't been here before... Maybe it goes up."; } break; case S_BROWNFALL: msg = "This doesn't seem like up... I guess I have to go forward now."; break; case S_PUZZLE: msg = "This is quite complicated. Who would have built a place like this?"; break; case S_BROWNTORCH: msg = "It feels like something moved somewhere. I should look around."; break; case S_BROWNEXIT: if(room == rBrownOut) { msg = "I see the door down there. I guess this was the way out."; } else { msg = "I think this is almost it. The exit shouldn't be far now..."; } break; } } else { switch(state[0]) { case S_BEGIN: msg = "What's that thing over there? It isn't white... Should I touch it?\nI think I use the Arrow Keys to walk."; if(Mobile) { msg = "What's that thing over there? It isn't white... Should I touch it?\nI think I touch the sides of the screen to walk."; } break; case S_BLACK: msg = "Whoa. That's new... I think I'll call this black.\nWhat's that up on the ledge?"; if(Mobile) { msg = "Whoa. That's new... I think I'll call this black.\nWhat's that up on the ledge? I should try touching both sides."; } break; case S_SOUND: if(image_blend == c_black) { msg = "I thought I lost these headphones long ago.\nAnd they still work too!"; } else if(image_blend == c_white) { msg = "There's a door up there now! I wonder what's outside..."; } break; case S_DOOR: msg = "There's another one over there! I should go get it!"; break; case S_FALL: if(room == rLongFall) { msg = "Well. Looks like I'll be late for dinner tonight...\nLet's look around down here."; } else if(room == rBottom) { msg = "That one looks funny. Its not white or black. Maybe... red?"; } break; case S_RED: msg = "Those things on the ground... They changed too.\nI wonder what else I can do."; break; case S_SWITCH: msg = "What does that switch do. I should try it."; break; case S_ENTERCAVE: if(room == rCaveEntrance) { msg = "Well that was disappointing.\nThis cave looks more interesting though."; } else if(room == rCave) { msg = "It's really dark in here... I'll have to be careful."; } else { msg = "I should go check out that cave."; } break; case S_CAVE: msg = "Why do I keep falling down things.\nI hope there's a way out of this cave."; break; case S_GREEN: msg = "Hey another spark. This one feels kind of like...\nGreen"; break; case S_LIFT: if(room == rCave) { msg = "Wow, this one actually works.\nI wonder if it's because of the green?"; } else if(room == rCaveEntrance) { msg = "Maybe this lift will work now too..!"; } else if(room == rMountain) { msg = "Looks like a long way up..."; } break; case S_BLUE: msg = "This one I will call blue.\nWhere are all these coming from?"; break; case S_WATER: if(room == rMountain) { msg = "This passage is new... Why is it so wet in here?"; } else if(room == rMountainLake) { msg = "There's a whole lake hidden on this mountain.\nAm I the first person to ever come here?"; } break; case S_PIRATE: if(room == rMountainLake) { msg = '"YARR! I be a pirate! I also be stuck on this ledge!"\n- The Pirate'; } else if(room == rField) { msg = "I guess that pirate is in a bit of a jam.\nI should try and help him out later."; } break; case S_PIT: if(room == rPit) { msg = "Really? Again? They should block off some of these holes..."; } else if(room == rCavern) { msg = "I guess I'll have to work on finding a way out of here now."; } break; case S_TOODARK: msg = "What's that thing? If only there was more light in this cave."; break; case S_YELLOW: msg = "This one is really bright. It's so... yellow."; break; case S_LIGHTS: msg = '"WHA! Who turned on the lights? They should be broken...\nIs the Machine not working any more?" - The Mechanic'; break; case S_MACHINE: if(room == rCavern) { msg = '"It was you! You broke the Machine! The colours cannot come back!"\n- The Mechanic'; } else if(room == rCavernExit) { msg = 'He said "The colours cannot come back"... Does that mean...\nThere used to be colours and he stole them all? How terrible.'; } break; case S_FIXING: if(room == rCavernExit) { msg = "I can hear him starting to fix it... I'll have find a way to stop him.\nLet's look around outside."; } else if(room == rBeach) { msg = "Wow. That's a lot of water. It's really pretty.\nThis would be a nice place to live. Maybe someone is nearby?"; } else if(room == rHouse) { msg = '"Hello? Who just barged into my house? Show yourself!"\n- The Old Guy'; } break; case S_ELDER: msg = '"Oh hello there young one. I see the colours are returning!\nI remember when there used to always be colour." - The Old Guy'; break; case S_BROWN: case S_SHAKING: if(room == rHouse) { msg = "This wasn't here a moment ago... Let's call it brown.\nI wonder if there are any more that will appear."; } else if(room == rBeach) { msg = "Wow. Everything looks so nice. I like these colours!"; } break; case S_COLGONE: if(room != rHouse) { msg = '"HELP! Everything is just white again!"\n- The Old Guy'; } else if(room == rHouse) { msg = '"Young one, you have returned! Come here!"\n- The Old Guy'; } break; case S_INTROOVER: if(room == rHouse) { msg = '"I believe the Mechanic has fixed the Machine again...\nI trust you to break it once and for all!" - The Old Guy'; } else if(room == rBeach) { msg = "Break the Machine huh. I guess I have to go back to that cavern then."; } else if(room == rCavern) { if(background_color == c_black) { msg = '"Welcome back. I fixed the Machine. The colours will never return!"\n- The Mechanic'; } else { msg = '"Oh no. You better not be about to..."\n- The Mechanic'; } } break; case S_DESTROYED: if(room == rCavern) { msg = '"You FOOL! The parts for the Machine are extremely rare.\nThere is no way I will ever repair it again..." - The Mechanic'; } else if(room == rSecretPassage) { msg = "Wow there's a secret passage in here.\nWhat's on the other side?"; } else if(room == rSplit) { msg = "Oh. Lots of stuff. How did I get sucked into this whole thing.\nI've started now, so I guess I have to save the colours."; } break; case S_SEARCHSTART: if(room == rSplit) { msg = "I have to find all the 5 colours. Which way next?"; } else if(room == rBlueStart) { if(colours[BLUE]) { msg = "The blue! The water is probably good now. Maybe it will lead me out."; } else { msg = "I wonder if there is a colour somewhere in this cave..."; } } else if(room == rRedStart) { if(colours[RED]) { msg = "So the red can also make heat. And I remember yellow can make light.\nMaybe the other colours have special properties too."; } else { msg = "Brr... It's cold up here. I hope there's a colour somewhere nearby."; } } else if(room == rRedDown) { if(colours[RED]) { msg = "I found red! Now how will I get back up there?"; } else { msg = "Looks like a long way down. I don't have much choice though..."; } } break; case S_COLBACK: if(room == rSplit) { msg = "That's all of them. The world is so beautiful!\nTime to go back to the other side of the mountain."; } else if(room == rSecretPassage) { msg = "The secret passage has caved in! Must have been all that\nshaking down below. I guess I have to go up there then..."; } else if(room == rCavein) { msg = "I can probably make it out through here...\nIt might be difficult though..."; } break; case S_FIRSTTRIAL: if(room == rFirstTrial) { msg = "The colours are gone! Some of them anyway... How strange."; } else { msg = "It's still colourful out here..."; } break; case S_SECONDTRIAL: if(room == rSecondTrial) { msg = "And now they're gone again!"; } else { msg = "This is very odd. The colours keep coming and going.\nMaybe they just have to settle in again?"; } break; case S_THIRDTRIAL: if(room == rThirdTrial) { msg = "How far down does this cave go? I'll never get out like this..." } else { msg = "Oh good, I made it back up. I hope there's a way out of this cave"; } break; case S_FOURTHTRIAL: if(room == rFourthTrial) { msg = "It seems there is no going back now... Maybe it's not much further!"; } else { msg = "Aha! I can finally see the exit!"; } break; case S_TRIALSDONE: if(room == rMountainLake) { msg = '"YARR! I be a pirate! The door is back, matey. I be outta here soon!"\n- The Pirate'; } else { msg = "Ugh. I don't like this cave.\nI don't think I can go back very far anyway."; } break; case S_HAPPYPIRATE: if(room == rMountainLake || room == rField) { msg = "I've been here before... I think the Old Guy isn't too far away.\nI should go find him"; } else if(room == rPit || room == rCavern) { msg = "Oh yes I remember this...\nThe Mechanic probably won't be happy to see me..."; } else { msg = "I'm pretty sure the Old Guy was the other way..."; } break; case S_ANGRYMECHANIC: if(room == rCavern) { msg = '"You are still alive?! How did you get out after I blew up the passage?"\n- The Mechanic'; } else if(room == rCavernExit) { msg = "So the cave in was because he blew up the passage...\nThat guy has something really wrong with him."; } else if(room == rBeach) { msg = "There's the Old Guy's house! I hope he's happy with all the colours back!"; } else if(room == rHouse) { msg = '"Welcome back sonny! Come up here!"\n- The Old Guy'; } break; case S_HAPPYOLDGUY: if(room == rHouse) { msg = '"The colours are all back! You did it! Go to the island just off the shore.\nI have something waiting for you there." - The Old Guy'; } else if(room == rBeach) { msg = "The island off shore, huh? I wonder what it could be."; } else if(room == rEnd) { msg = '"This door will take you back home, though it is only good one way.\nStep through when you are ready..." - The Old Guy'; } else if(room == rLongFall || room == rWhite) { msg = "That was quite the adventure... But you know what..?\nI kind of liked the world when everything was all just"; } else { msg = "This world is so nice now that the colours are all back..."; } break; default: msg = "What was I doing again?"; break; } } msg = string_replace_all(msg, "\n", "# "); if(prevMsg != msg) { msgPos = 0; } 1 603 7 0 0 -1 2 self 0 0 1 ///Start the game if(room == rSetup) { if(input_check_pressed(I_ACTION)) { if(keyboard_string != "" && GameJolt && !useGameJolt) { var username = string_copy(keyboard_string, 1, string_pos("#", keyboard_string) - 1); var token = string_copy(keyboard_string, string_pos("#", keyboard_string) + 1, string_length(keyboard_string)); GameJoltLoginHandle = gj_user_login(username, token); } instance_create(32, 416, Player); room_goto(rHome); } else if(input_check_pressed(I_JUMP)) { if(keyboard_string != "" && GameJolt && !useGameJolt) { var username = string_copy(keyboard_string, 1, string_pos("#", keyboard_string) - 1); var token = string_copy(keyboard_string, string_pos("#", keyboard_string) + 1, string_length(keyboard_string)); GameJoltLoginHandle = gj_user_login(username, token); } if(file_exists(working_directory + "white.sav")) { var in = file_text_open_read(working_directory + "white.sav"); var out = file_text_open_write(working_directory + "temp.ini"); while(!file_text_eof(in)) { file_text_write_string(out, decrypt(file_text_read_string(in))); file_text_readln(in); file_text_writeln(out); } file_text_close(out); file_text_close(in) ini_open(working_directory + "temp.ini"); var xx = ini_read_real("game", "x", -1), yy = ini_read_real("game", "y", -1), cc = ini_read_real("game", "c", -1), rr = ini_read_real("game", "r", noone), if(xx != -1 && yy != -1 && cc != -1 && room_exists(rr)) { instance_create(xx, yy, Player); image_blend = cc; for(var i = 0; i < array_length_1d(state); i++) { state[i] = ini_read_real("game", string(i), 0); } for(var i = 0; i < array_length_1d(colours); i++) { colours[i] = ini_read_real("game", string(i) + "_2", 0); } set_tiles(); room_goto(rr); } ini_close(); file_delete(working_directory + "temp.ini"); } } } 1 603 7 0 0 -1 2 self 0 0 1 ///Shake the screen if(shake != 0) { if(shakeSound == noone) { shakeSound = audio_play_sound(aShake, 0, false); audio_sound_gain(shakeSound, 0.6, 0); } view_enabled = true; view_visible[0] = true; view_object[0] = noone; view_xview[0] = median(Player.x - view_wview[0] / 2, 0, room_width - view_wview[0]) + choose(-1, 1) * (shake / 10); view_yview[0] = median(Player.y - view_hview[0] / 2, 0, room_height - view_hview[0]) + choose(-1, 1) * (shake / 10); shake--; } else { shakeSound = noone; if(instance_exists(Player)) { view_object[0] = Player; view_hborder[0] = 1000; view_vborder[0] = 1000; } } 1 603 7 0 0 -1 2 self 0 0 1 ///Run the music /* Without the position function */ if(state[0] >= S_SOUND) { if(!audio_is_playing(music[WHITE])) { music[WHITE] = audio_play_sound(aWhite, 0, true); music[BLACK] = audio_play_sound(aBlack, 0, true); music[RED] = audio_play_sound(aRed, 0, true); music[GREEN] = audio_play_sound(aGreen, 0, true); music[BLUE] = audio_play_sound(aBlue, 0, true); music[YELLOW] = audio_play_sound(aYellow, 0, true); music[BROWN] = audio_play_sound(aBrown, 0, true); for(var i = WHITE; i <= BROWN; i++) { audio_sound_gain(music[i], 0, 0); } } if(coltonum(image_blend) == 100) { //Balance song nicely for the ending if(room != rWhite) { if(music_gain[WHITE] != 0.5) { audio_sound_gain(music[WHITE], 0.5, 500) music_gain[WHITE] = 0.5; } if(music_gain[BLACK] != 0.7) { audio_sound_gain(music[BLACK], 0.7, 500); music_gain[BLACK] = 0.7; } if(music_gain[RED] != 0.4) { audio_sound_gain(music[RED], 0.4, 500); music_gain[RED] = 0.4; } if(music_gain[GREEN] != 0.5) { audio_sound_gain(music[GREEN], 0.5, 500); music_gain[GREEN] = 0.5; } if(music_gain[BLUE] != 0.8) { audio_sound_gain(music[BLUE], 0.8, 500); music_gain[BLUE] = 0.8; } if(music_gain[YELLOW] != 0.8) { audio_sound_gain(music[YELLOW], 0.8, 500); music_gain[YELLOW] = 0.8; } if(music_gain[BROWN] != 0.3) { audio_sound_gain(music[BROWN], 0.3, 500); music_gain[BROWN] = 0.3; } } else { if(music_gain[WHITE] != 0) { audio_sound_gain(music[WHITE], 0, 5000); audio_sound_gain(music[BLACK], 0, 5000); audio_sound_gain(music[RED], 0, 5000); audio_sound_gain(music[GREEN], 0, 5000); audio_sound_gain(music[BLUE], 0, 5000); audio_sound_gain(music[YELLOW], 0, 5000); audio_sound_gain(music[BROWN], 0, 5000); music_gain[WHITE] = 0; } } } else if(room != rWhite) { for(var i = WHITE; i <= BROWN; i++) { if(!colours[i]) { audio_sound_gain(music[i], 0, 0); music_gain[i] = 0; } else { if(coltonum(image_blend) == i) { if(music_gain[i] <= 0.2) { audio_sound_gain(music[i], 0.5, 500); } music_gain[i] = 0.5; } else if(coltonum(image_blend) != noone) { if(music_gain[i] != 0.2) { audio_sound_gain(music[i], 0.2, 500); } music_gain[i] = 0.2; } } } } } else { //Stop only the music if the earphones aren't collected yet. Other things still make full sound if(music[WHITE] != noone) { if(audio_is_playing(music[WHITE])) { audio_stop_sound(music[WHITE]); music[WHITE] = noone; } } if(music[BLACK] != noone) { if(audio_is_playing(music[BLACK])) { audio_stop_sound(music[BLACK]); music[BLACK] = noone; } } if(music[RED] != noone) { if(audio_is_playing(music[RED])) { audio_stop_sound(music[RED]); music[RED] = noone; } } if(music[GREEN] != noone) { if(audio_is_playing(music[GREEN])) { audio_stop_sound(music[GREEN]); music[GREEN] = noone; } } if(music[BLUE] != noone) { if(audio_is_playing(music[BLUE])) { audio_stop_sound(music[BLUE]); music[BLUE] = noone; } } if(music[YELLOW] != noone) { if(audio_is_playing(music[YELLOW])) { audio_stop_sound(music[YELLOW]); music[YELLOW] = noone; } } if(music[BROWN] != noone) { if(audio_is_playing(music[BROWN])) { audio_stop_sound(music[BROWN]); music[BROWN] = noone; } } } 1 603 7 0 0 -1 2 self 0 0 1 ///Pulse and shake when the machine is fixed if(state[0] == S_BROWN) { if(msgPos <= string_length(msg)) { if(string_copy(msg, msgPos, 1) == "!") { shake = 36 * 3; pulseCount = 3; pulseColor = c_white; state_set(S_SHAKING); } } } else if(state[0] == S_SHAKING) { if(pulseCount == 1) { if(power(sin(degtorad(pulseAlpha)) + 1, 2) == 4) { for(var i = array_length_1d(colours); i > 0; i--) { colours[i] = false; } image_blend = c_white; background_assign(tsUse, tsW); state_set(S_COLGONE); } } } 1 603 7 0 0 -1 2 self 0 0 1 ///Close with ALT-F4 if(keyboard_check_direct(vk_alt) && keyboard_check_pressed(vk_f4)) { game_end(); } 1 603 7 0 0 -1 2 self 0 0 1 /// Game Jolt stuff if(useGameJolt) { if(!gameJoltTimer--) { gj_session_ping(true); gameJoltTimer = 30 * room_speed; } } 1 603 7 0 0 -1 2 self 0 0 1 ///Game Jolt API call returns var resultID = gj_result_id(); if(resultID = GameJoltLoginHandle) { if(gj_result_status() == 1) { if(gj_user_isloggedin()) { useGameJolt = true; } } else { GameJoltLoginFailedTimer = room_speed * 5; } } 1 603 7 0 0 -1 2 self 0 0 1 ///Move Player to door if(instance_exists(Player)) { if(destID != -1) { with(Door) { if(thisID == other.destID) { Player.x = x; Player.y = y; } } } } destID = -1; 1 603 7 0 0 -1 2 self 0 0 1 ///Change state for various events //Start searching for colours again if(room == rRedStart || room == rBlueStart || room == rGreenStart || room == rYellowStart || room == rBrownStart) { state_set(S_SEARCHSTART); } if(room == rYellowStart) { if(colours[YELLOW]) { state_set(S_COLBACK); } } if(room == rFirstTrial) { state_set(S_FIRSTTRIAL); } if(room == rSecondTrial) { state_set(S_SECONDTRIAL); } if(room == rMountainLake) { state_set(S_TRIALSDONE); } 1 603 7 0 0 -1 2 self 0 0 1 ///Events for ending and title screens //Fade in text if(room == rSetup || room == rWhite) { image_alpha = 0; } else if(room == rLongFall && state[0] >= S_HAPPYOLDGUY) { image_alpha = -1; } //Return to beginning after a while if(room == rWhite) { alarm[0] = room_speed * 10; } 1 603 7 0 0 -1 2 self 0 0 1 ///Save on room start if(room != rSetup && room != rWhite && room != rHome) { save(); } 1 603 7 0 0 -1 2 self 0 0 1 ///Mobile stuff if(Mobile) { if(room != rSetup) { virt_key_left = virtual_key_add(0, 0, display_get_width() / 2, display_get_height(), vk_left); virt_key_right = virtual_key_add(display_get_width() / 2, 0, display_get_width() / 2, display_get_height(), vk_right); virt_key_down = virtual_key_add(0, 0, 0, 0, vk_down); virtual_key_delete(virt_key_up); } else { virt_key_up = virtual_key_add(0, 0, display_get_width(), display_get_height() / 2, vk_up); virt_key_down = virtual_key_add(0, display_get_height() / 2, display_get_width(), display_get_height() / 2, vk_down); } view_enabled = true; view_visible[0] = true; view_wview[0] = 640; view_hview[0] = display_get_height(); view_wport[0] = view_wview[0]; view_hport[0] = view_hview[0]; if(instance_exists(Player)) { view_object[0] = Player; view_hborder[0] = 1000; view_vborder[0] = 1000; view_hspeed[0] = -1; view_vspeed[0] = -1; } surface_resize(application_surface, view_wport[0], view_hport[0]); } 1 603 7 0 0 -1 2 self 0 0 1 ///End Game Jolt stuff if(GameJolt && useGameJolt) { gj_session_close(); gj_user_logout(); } 1 603 7 0 0 -1 2 self 0 0 1 ///Initialize useGameJolt = GameJolt; gameJoltTimer = 0; GameJoltLoginFailedTimer = 0; GameJoltLoginHandle = noone; GameJoltTrophyHandle = noone; if(initGameJolt && useGameJolt) { //Set in Create to prevent being initalized twice gj_init("35169", "5be9b80b7ebd9a82c2715aa84e3357c3"); // Game Jolt API gj_user_autologin() if(!gj_user_isloggedin()) { // Check for user login by Quick Play useGameJolt = false; } if(useGameJolt) { gj_session_open(); } keyboard_string = ""; initGameJolt = false; } virt_key_left = noone; virt_key_right = noone; virt_key_up = noone; virt_key_down = noone; c_brown = make_color_rgb(75, 50, 25); shake = 0; shakeSound = noone; pulseCount = 0; pulseColor = noone; pulseAlpha = 0; msgPos = 0; msgSpd = 2; msg = ""; state[3] = S_BEGIN; state[2] = S_BEGIN; state[1] = S_BEGIN; state[0] = S_BEGIN; /*background_save(tsW, working_directory + "tsW.png"); background_save(tsBW, working_directory + "tsBW.png"); background_save(tsBWG, working_directory + "tsBWG.png"); background_save(tsBWR, working_directory + "tsBWR.png"); background_save(tsBWRG, working_directory + "tsBWRG.png"); background_save(tsBWRN, working_directory + "tsBWRN.png"); background_save(tsBWRGY, working_directory + "tsBWRGY.png"); background_save(tsBWRGN, working_directory + "tsBWRGN.png"); background_save(tsBWRGYN, working_directory + "tsBWRGYN.png"); background_replace(tsUse, working_directory + "tsW.png", true, false);*/ destID = -1; colours[BROWN] = false; colours[YELLOW] = false; colours[BLUE] = false; colours[GREEN] = false; colours[RED] = false; colours[BLACK] = false; colours[WHITE] = true; music[BROWN] = noone; music[YELLOW] = noone; music[BLUE] = noone; music[GREEN] = noone; music[RED] = noone; music[BLACK] = noone; music[WHITE] = noone; music_gain[BROWN] = 0; music_gain[YELLOW] = 0; music_gain[BLUE] = 0; music_gain[GREEN] = 0; music_gain[RED] = 0; music_gain[BLACK] = 0; music_gain[WHITE] = 0; musicResetOk[BROWN] = true; musicResetOk[YELLOW] = true; musicResetOk[BLUE] = true; musicResetOk[GREEN] = true; musicResetOk[RED] = true; musicResetOk[BLACK] = true; musicResetOk[WHITE] = true; image_blend = c_white; randomize(); //Optimization //draw_set_alpha_test(true); //draw_set_alpha_test_ref_value(0); if(os_browser != browser_not_a_browser) { if(!webgl_enabled) { application_surface_enable(false); } sprite_set_cache_size(sPlayer, ceil(sqrt(116))); sprite_set_cache_size(sBird, 5); sprite_set_cache_size(sButterfly, 5); } 1 603 7 0 0 -1 2 self 0 0 1 ///Title Screen if(room == rSetup) { draw_set_font(fTitle); draw_set_halign(fa_center); draw_set_color(c_black); draw_text(room_width / 2, 100, "White"); draw_set_font(fDefault); image_alpha = min(image_alpha + 1/room_speed, 1); draw_set_alpha(image_alpha); draw_text(room_width / 2, 200, "Press the Down Arrow key to begin"); if(file_exists(working_directory + "\white.sav")) { draw_text(room_width / 2, 150, "Press the Up Arrow key to load"); } if(GameJolt && !useGameJolt) { draw_text(room_width / 2, 250, "GameJolt login? Type username, hit Enter, and then token."); if(keyboard_check_pressed(vk_enter)) { keyboard_string += "#"; } if(string_count("#", keyboard_string) > 1) { //Clip anything past the first # keyboard_string = string_copy(keyboard_string, 1, string_pos("#", keyboard_string) + string_pos("#", string_copy(keyboard_string, string_pos("#", keyboard_string) + 1, string_length(keyboard_string))) - 1); } draw_text(room_width / 2, 282, keyboard_string + "_"); } draw_set_alpha(1); draw_set_halign(fa_left); } 1 603 7 0 0 -1 2 self 0 0 1 ///End Screen if(room == rWhite) { draw_set_font(fTitle); draw_set_halign(fa_center); draw_set_color(c_black); image_alpha = min(image_alpha + 1/(room_speed * 3), 1); draw_set_alpha(image_alpha); draw_text(room_width / 2, 100, "White"); draw_set_font(fDefault); draw_set_halign(fa_right); draw_set_valign(fa_bottom); draw_text(room_width - 5, room_height - 5, "(c) 2014 - A Game by Cameron Eldridge."); draw_set_alpha(1); draw_set_halign(fa_left); draw_set_valign(fa_top); } else if(room == rLongFall && state[0] >= S_HAPPYOLDGUY) { image_alpha = min(image_alpha + 1/136 * 2, 1); draw_set_alpha(image_alpha); draw_set_color(c_white); draw_rectangle(0, 0, view_wview[0], view_hview[0], false); draw_set_alpha(1); } 1 603 7 0 0 -1 2 self 0 0 1 ///Pulse colors if(pulseColor != noone) { pulseAlpha = (pulseAlpha + 10) % 360 draw_set_alpha(power(sin(degtorad(pulseAlpha)) + 1, 2) / 4); draw_set_color(pulseColor); draw_rectangle(0, 0, window_get_width(), window_get_height(), false); draw_set_alpha(1); if(pulseAlpha == 0) { pulseCount--; if(pulseCount == 0) { pulseColor = noone; } } } 1 603 7 0 0 -1 2 self 0 0 1 ///Draw thoughts if(room != rSetup) { draw_set_color(c_ltgray); draw_set_font(fDefault); var alphas, cAlpha = 0, cX = 5, cY = 5, substr = ""; msgPos = min(msgPos + 1, string_length(msg) - 1 + 10); alphas[msgPos] = 0; for(var i = msgPos; i >= 0; i--) { alphas[i] = cAlpha; cAlpha += 0.1; } for(var i = 0; i < min(msgPos, string_length(msg)); i++) { substr = string_copy(msg, i + 1, 1); if(substr == "#") { cX = 5; cY += string_height("A"); } else { draw_set_alpha(alphas[i]); draw_text(cX, cY, substr); cX += string_width(substr); } } draw_set_alpha(1); } 1 603 7 0 0 -1 2 self 0 0 1 ///Draw error if Game Jolt login failed if(GameJolt && GameJoltLoginFailedTimer != 0) { draw_text(32, view_hport[0] - 32, "Game Jolt login failed. Restart the game to try again."); GameJoltLoginFailedTimer--; } 0 0 0 0.5 0.100000001490116 0 0.100000001490116 0.100000001490116 0.200000002980232 -1 0 12,32 16,16