Added a credits screen.
This commit is contained in:
parent
65d6722122
commit
e5353026e1
|
@ -1,5 +1,6 @@
|
||||||
function titleScreen () {
|
function titleScreen () {
|
||||||
guiControl.title = {
|
guiControl.title = {
|
||||||
|
screen: "main",
|
||||||
show: true,
|
show: true,
|
||||||
cursorPosition: 0,
|
cursorPosition: 0,
|
||||||
activateDelay: 0,
|
activateDelay: 0,
|
||||||
|
@ -17,74 +18,93 @@ function drawTitleScreen() {
|
||||||
if (guiControl.title && guiControl.title.show) {
|
if (guiControl.title && guiControl.title.show) {
|
||||||
guiControl.title.activateDelay -= (guiControl.title.activateDelay > 0) ? 1 : 0;
|
guiControl.title.activateDelay -= (guiControl.title.activateDelay > 0) ? 1 : 0;
|
||||||
|
|
||||||
if (ct_down().down) {
|
if (guiControl.title.screen == "main") {
|
||||||
snd_cursordown.Play();
|
if (ct_down().down) {
|
||||||
guiControl.title.cursorPosition++;
|
snd_cursordown.Play();
|
||||||
}
|
guiControl.title.cursorPosition++;
|
||||||
if (ct_up().down) {
|
}
|
||||||
snd_cursordown.Play();
|
if (ct_up().down) {
|
||||||
guiControl.title.cursorPosition--;
|
snd_cursordown.Play();
|
||||||
}
|
guiControl.title.cursorPosition--;
|
||||||
|
}
|
||||||
// console.log(guiControl.title.screen);
|
|
||||||
// Limit Cursor
|
// console.log(guiControl.title.screen);
|
||||||
if (guiControl.title.cursorPosition < 0) {
|
// Limit Cursor
|
||||||
guiControl.title.cursorPosition = 2;
|
if (guiControl.title.cursorPosition < 0) {
|
||||||
}
|
guiControl.title.cursorPosition = 2;
|
||||||
if (guiControl.title.cursorPosition > 2) {
|
}
|
||||||
guiControl.title.cursorPosition = 0;
|
if (guiControl.title.cursorPosition > 2) {
|
||||||
}
|
guiControl.title.cursorPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
OS.context.drawImage(guiControl.titleImage, 0, 0);
|
OS.context.drawImage(guiControl.titleImage, 0, 0);
|
||||||
|
|
||||||
// New Game
|
// New Game
|
||||||
guiControl.drawPixelText("New Game", guiControl.title.leftBorder, guiControl.title.rowTop(0), 10, "white", 6);
|
guiControl.drawPixelText("New Game", guiControl.title.leftBorder, guiControl.title.rowTop(0), 10, "white", 6);
|
||||||
// Load Game
|
// Load Game
|
||||||
guiControl.drawPixelText("Continue", guiControl.title.leftBorder, guiControl.title.rowTop(1), 10, (G.savedGameExists) ? "white" : "black", 6);
|
guiControl.drawPixelText("Continue", guiControl.title.leftBorder, guiControl.title.rowTop(1), 10, (G.savedGameExists) ? "white" : "black", 6);
|
||||||
// Options
|
// Options
|
||||||
guiControl.drawPixelText("Options", guiControl.title.leftBorder, guiControl.title.rowTop(2) + pixel(), 8, (guiControl.optionsScreen) ? "white" : "black", 6);
|
guiControl.drawPixelText("Options", guiControl.title.leftBorder, guiControl.title.rowTop(2) + pixel(), 8, (guiControl.optionsScreen) ? "white" : "black", 6);
|
||||||
|
|
||||||
// Draw cursor
|
// Draw cursor
|
||||||
OS.context.drawImage(guiControl.cursor, guiControl.title.leftBorder - (guiControl.iconScaled), guiControl.title.rowTop(guiControl.title.cursorPosition));
|
OS.context.drawImage(guiControl.cursor, guiControl.title.leftBorder - (guiControl.iconScaled), guiControl.title.rowTop(guiControl.title.cursorPosition));
|
||||||
|
|
||||||
// Button Action
|
// Button Action
|
||||||
if (guiControl.title.activateDelay <= 0) {
|
if (guiControl.title.activateDelay <= 0) {
|
||||||
if (ct_confirm().down) {
|
if (ct_confirm().down) {
|
||||||
switch (guiControl.title.cursorPosition) {
|
switch (guiControl.title.cursorPosition) {
|
||||||
case 0:
|
case 0:
|
||||||
snd_select.Play();
|
|
||||||
mus_title.Stop();
|
|
||||||
mus_sail.Play();
|
|
||||||
guiControl.title.show = false;
|
|
||||||
G.gameStarted = true;
|
|
||||||
G.SaveGame();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (G.savedGameExists) { // once loading is in, allow this.
|
|
||||||
G.LoadGame();
|
|
||||||
snd_select.Play();
|
snd_select.Play();
|
||||||
mus_title.Stop();
|
mus_title.Stop();
|
||||||
mus_sail.Play();
|
mus_sail.Play();
|
||||||
guiControl.title.show = false;
|
guiControl.title.show = false;
|
||||||
G.gameStarted = true;
|
G.gameStarted = true;
|
||||||
} else {
|
G.SaveGame();
|
||||||
snd_cannotbuy.Play();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (false) { // once loading is in, allow this.
|
|
||||||
snd_select.Play();
|
|
||||||
guiControl.title.show = false;
|
|
||||||
guiControl.options.show = true;
|
|
||||||
break;
|
break;
|
||||||
} else {
|
case 1:
|
||||||
snd_cannotbuy.Play();
|
if (G.savedGameExists) { // once loading is in, allow this.
|
||||||
}
|
G.LoadGame();
|
||||||
|
snd_select.Play();
|
||||||
|
mus_title.Stop();
|
||||||
|
mus_sail.Play();
|
||||||
|
guiControl.title.show = false;
|
||||||
|
G.gameStarted = true;
|
||||||
|
} else {
|
||||||
|
snd_cannotbuy.Play();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (false) { // once loading is in, allow this.
|
||||||
|
snd_select.Play();
|
||||||
|
guiControl.title.show = false;
|
||||||
|
guiControl.options.show = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
snd_cannotbuy.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guiControl.title.cursorPosition = 0;
|
||||||
|
// console.log(guiControl.title.screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
guiControl.title.cursorPosition = 0;
|
if (ct_cancel().down) {
|
||||||
// console.log(guiControl.title.screen);
|
guiControl.title.screen = "credits";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (guiControl.title.screen == "credits") {
|
||||||
|
guiControl.drawPixelText("Credits", guiControl.title.leftBorder - pixel(), pixel(2), 0, "white", 6);
|
||||||
|
guiControl.drawPixelText("Music, Icons", pixel(), pixel(11), 0, "white", 4);
|
||||||
|
guiControl.drawPixelText("Paws Menu", pixel(2), pixel(17), 0, "yellow", 6);
|
||||||
|
guiControl.drawPixelText("paws.bandcamp.com", pixel(2), pixel(25), 0, "yellow", 4);
|
||||||
|
guiControl.drawPixelText("Evrthng Else", pixel(), pixel(39), 0, "white", 4);
|
||||||
|
guiControl.drawPixelText("Alamantus", pixel(2), pixel(45), 0, "yellow", 6);
|
||||||
|
guiControl.drawPixelText("alamantus.com", pixel(2), pixel(53), 0, "yellow", 4);
|
||||||
|
|
||||||
|
if (ct_confirm().down || ct_cancel().down || ct_esc.down) {
|
||||||
|
guiControl.title.screen = "main";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue