top of page
Search

Starting and Saving

  • seanmcgarry65
  • Mar 24, 2023
  • 3 min read

This week, I added two new menus to the game, as well as a short cutscene.


This screen is what the player will now see as soon as they start a new game. The game will not continue until they put something in the text box, and when they do, they can proceed to the rest of the game by pressing enter.


When the player gets to the game, the name they entered will be visible in their inventory, right above their current level and experience, and below the item select menu.


This code is what controls progress through the new game menu. When the player presses enter, the game checks to see if there's anything typed into the text input box. If there isn't, then the game does nothing. If there is, it sets a global variable to the contents of the box, which is used to check what the player's name is in the game, and then sends the game to the Overworld layout.


This is now the very first screen the player will see upon starting the game. The player is given two options here; New Game and Continue. Selecting New Game will send the player to the layout discussed above, while selecting Continue will allow the player to pick up where they left off if they've played the game previously.


This code controls which option is selected on the start screen. Every time the player presses the up or down arrow keys, it toggles whether the New Game option is selected or not. If it New Game is selected, it sets that option's text color to yellow, and point size to eight, while setting Continue's color to black and point size to six. If New Game is not selected, then the opposite occurs, where New Game is colored black and set to six point font, while Continue is set to yellow and eight point font.


While on the start menu, one of two things will happen if the player hits the enter key. If the New Game option is selected, the player will be sent to next menu to enter their character's name. If it is not selected, the game loads their progress from a previous session and sends them to the game.


On the start of the layout, the game automatically saves the player's progress to an appropriately named slot.


There is also a new cutscene in the game that plays when the player approaches a particular NPC on the overworld layout.


First, the game checks if the player has collided with a player trigger with the appropriate name, in this case 'RivalIntro' AND that the cutscene has not played yet. If all of those are true, then an instance variable saying that the player is in a cutscene is set to true (Which disables the player's movement), and the player's current animation stops.


Next, the game picks an NPC whose name variable is set to AJ. Once it has done that, it sets the layout scale to 1.5, spawns an NPC cutscene text object, and sets that object to be just below the NPC.


This is the script for the cutscene. It sets the text for what the NPC is saying, then waits three seconds before moving on to the next line. It repeats this process until it gets to the end of the cutscene, at which point it destroys the text object, sets the layout scale back to one, sets the variable controlling whether or not the player is in a cutscene back to false, and marks the cutscene as having played.


If you would like to play the game in its current state, you can do so by following the link below.



 
 
 

Recent Posts

See All

Comentários


bottom of page