Skip to content

Commit

Permalink
(Saveless) Menu Done!
Browse files Browse the repository at this point in the history
  • Loading branch information
Animeliqite committed Oct 9, 2022
1 parent dea559d commit 2325eba
Show file tree
Hide file tree
Showing 14 changed files with 179 additions and 12 deletions.
6 changes: 6 additions & 0 deletions UnderStudio 2.0/UnderStudio 2.0.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added UnderStudio 2.0/datafiles/mus/cymbal.ogg
Binary file not shown.
3 changes: 3 additions & 0 deletions UnderStudio 2.0/objects/obj_fadinghandler/Alarm_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// @description Fade

execute_tween(id, "faderAlpha", faderAlphaTarget, "linear", faderDuration, false);
7 changes: 7 additions & 0 deletions UnderStudio 2.0/objects/obj_fadinghandler/Create_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// @description Initialize

faderColor = c_black;
faderDuration = 0.25;
faderAlphaTarget = 1;
faderAlpha = 0;
alarm[0] = 1;
9 changes: 9 additions & 0 deletions UnderStudio 2.0/objects/obj_fadinghandler/Draw_64.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// @description Draw the fader

var colorOld = draw_get_color(), alphaOld = draw_get_alpha();
draw_set_color(faderColor);
draw_set_alpha(faderAlpha);
draw_rectangle(0, 0, 640, 480, false);

draw_set_color(colorOld);
draw_set_alpha(alphaOld);
35 changes: 35 additions & 0 deletions UnderStudio 2.0/objects/obj_fadinghandler/obj_fadinghandler.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions UnderStudio 2.0/objects/obj_menuhandler/Alarm_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// @description Proceed to the next room

instance_destroy(cymbalFader);
global.playerName = namingName;
song_stop(menuMusic);
room_goto_next();
3 changes: 3 additions & 0 deletions UnderStudio 2.0/objects/obj_menuhandler/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ namingLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
namingOptions = ["Exit", "Backspace", "Done"];
namingRows = 7;

namingHeaderConfirm = "Is this name correct?"
namingOptionsConfirm = ["No", "Yes"];
namingNameXOffset = 0;
namingNameYOffset = 0;
namingNameScale = 0;

musicFile = song_load("menu0");
menuMusic = song_play(musicFile, 1, 1);
tweenExecutedOnce = false;
cymbalFader = noone;

settingsCurtainX = [320, 320];
17 changes: 12 additions & 5 deletions UnderStudio 2.0/objects/obj_menuhandler/Draw_64.gml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,23 @@ switch (state) {

// Draw the naming header
draw_ftext(320, 60, namingHeader, fnt_main, c_white, 1, 1, 1, 0, fa_center);
draw_ftext(320, 100, namingName, fnt_main, c_white, 1, 1, 1, 0, fa_center);
draw_ftext(280, 100, namingName, fnt_main, c_white, 1, 1, 1, 0);

// Draw the naming options
draw_ftext(120, 400, namingOptions[0], fnt_main, selection == 0 && subState == 2 ? c_yellow : c_white);
draw_ftext(240, 400, namingOptions[1], fnt_main, selection == 1 && subState == 2 ? c_yellow : c_white);
draw_ftext(440, 400, namingOptions[2], fnt_main, selection == 2 && subState == 2 ? c_yellow : c_white);
break;
case 2:
draw_ftext(320 + namingNameXOffset - (string_width(namingName) / 2), 100 + namingNameYOffset, namingName, fnt_main, c_white, 1, 1 + namingNameScale, 1 + namingNameScale, random(2), fa_left);
case 3:
// Draw the naming header
draw_ftext(320, 60, namingHeaderConfirm, fnt_main, c_white, 1, 1, 1, 0, fa_center);

// Draw the naming options
draw_ftext(146, 400, namingOptionsConfirm[0], fnt_main, selection == 0 ? c_yellow : c_white);
draw_ftext(460, 400, namingOptionsConfirm[1], fnt_main, selection == 1 ? c_yellow : c_white);

// Draw the naming text
draw_ftext(280 + namingNameXOffset, 100 + namingNameYOffset, namingName, fnt_main, c_white, 1, 1 + namingNameScale, 1 + namingNameScale, -random(2));
break;
}

draw_ftext(10, 10, selection);
}
32 changes: 29 additions & 3 deletions UnderStudio 2.0/objects/obj_menuhandler/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ switch (state) {
state = 2;
subState = 0;
selection = 0;

tweenExecutedOnce = false;
namingNameXOffset = 0;
namingNameYOffset = 0;
namingNameScale = 0;
}
break;
}
Expand All @@ -121,11 +125,33 @@ switch (state) {
}
break;
case 2:
if (BT_LEFT_P) selection = number_sub(selection, 0);
if (BT_RIGHT_P) selection = number_add(selection, 1);

// Confirmation
if (BT_ENTER_P) {
switch (selection) {
case 0: state = 1; subState = 0; selection = 0; break;
case 1: state = 3; subState = 0; selection = 0; break;
}
}

if (!tweenExecutedOnce) {
execute_tween(id, "namingNameXOffset", 20, "linear", 4, false);
execute_tween(id, "namingNameYOffset", 60, "linear", 4, false);
execute_tween(id, "namingNameScale", 2, "linear", 4, false);
execute_tween(id, "namingNameXOffset", -40, "linear", 3, false);
execute_tween(id, "namingNameYOffset", 60, "linear", 3, false);
execute_tween(id, "namingNameScale", 3, "linear", 3, false);
tweenExecutedOnce = true;
}
break;
case 3:
if (subState == 0) {
song_stop(musicFile);
musicFile = song_load("cymbal");
song_play(musicFile);

cymbalFader = screen_fade(0, 1, audio_sound_length(musicFile), c_white);
if (alarm[0] < 0) alarm[0] = audio_sound_length(musicFile) * game_get_speed(gamespeed_fps);
subState = 1;
}
break;
}
1 change: 1 addition & 0 deletions UnderStudio 2.0/objects/obj_menuhandler/obj_menuhandler.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions UnderStudio 2.0/rooms/room_empty/room_empty.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions UnderStudio 2.0/scripts/animation/animation.gml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,18 @@ function execute_tween(instance, variable, targetValue, curveSubName = "linear",
duration = seconds;
self.delay = delay;
}
}

// This script creates a fader object which fades in/out the screen.
function screen_fade(alphaBegin, alphaStop, duration = 0.25, fadingColor = c_black) {
// Set the values
var faderInst = instance_create_depth(0, 0, -9999, obj_fadinghandler)
with (faderInst) {
faderAlpha = alphaBegin;
faderAlphaTarget = alphaStop;
faderDuration = duration;
faderColor = fadingColor;
}

return faderInst;
}
7 changes: 3 additions & 4 deletions UnderStudio 2.0/scripts/animation/animation.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2325eba

Please sign in to comment.