Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [GM][TAW]Title Screen
HeroOfHyla
post Jun 1 2009, 02:28 PM
Post #1


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




RPG Style Title Screen
Alright, this is the second tutorial for the TAW Program (main topic: http://www.rpgrevolution.com/forums/index....howtopic=31232)!
Note! I'm assuming you're using Game Maker 7 Lite for this tutorial. If you have Pro, like me, you can get a bit more functionality out of this. You'll need to experiment on your own for that.

I'll be including all the resources I post here in the actual demo file too, if you don't feel like downloading them individually.

This tutorial will teach how to create a basic title screen for your game. It will have the basic RPG style options:
CODE
-New Game
-Load
-Quit

I'll also discuss how to implement various other optional features, like a settings menu.

First things first, you decide on some resources to use for the title screen. You'll probably want the following:
Background image
Music
Picture with the menu options on it (unless you're using a script to display windows, but I'm assuming you're not)
Cursor
Any other animated graphics you want on the title screen

I'm going to assume that you're using the default 640x480 game resolution. Go ahead and make the background image first. If you don't have one, you're free to try out this one:


Now time to find music! You need to use WAV or MIDI files, or else Game Maker will use the computer's media player to play them instead of playing them right from the program. If you're planning on releasing your game, you shouldn't use any music you don't have the rights to. I recommend going to http://www.musopen.com/ if you want free music that you can legally use, or you can of course make your own music or ask someone to make it for you. If you want a track to use, you're free to use this: http://www.mediafire.com/download.php?wgg5tzvtmwo
It's not very good, but it's what you get for the price. It's just a little thing i recorded quickly on my rather cheap keyboard (that's why there's a high pitched noise behind it).

Make an image with all the options you want on it. I'm going to be going with "New Game" "Load" and "Quit." Here's the one I made:


Now for a cursor image! Make sure that it's about the size of a line of text on your options picture. Here's one I made:


I'm not going to make any extra graphics for animations, but you're perfectly able to if you want.

It's finally time to open up Game Maker! Import the Cursor as a sprite. Make sure it's set to transparent. Import the Background as a background. Do not make it transparent. Import the options as a sprite. Make it transparent. If you have Game Maker 7 Lite, import the music as a sound. If you have Pro, you might want to consider keeping the music seperate and importing it in-game to speed up load time.

Now that you have all the resources you need in place, it's time time begin. Create a room, and set your title screen background as the background. Create an object, and set the sprite to your options sprite. Then go into the room and lay it in a good centered position.
[Show/Hide] Here's what mine looks like so far




Make an object for your cursor too. To position it correctly in the room, you'll need to turn off "delete underlying" and set the grid very small. I wound up using a 2 pixel grid to position it properly.

Now we're going to make the cursor actually move. Because there are so few possible options on the title screen list, it's going to probably be better to have the player press the key each time he or she wants to move the cursor, instead of trying to code a good system for time delays in movement. The system we're doing is going to be very easy. Make 2 events, one for Key pressed > up and one for key pressed > down. Go in to the "control" tab and find "set variable." Set the variable "position" to 1 for the down arrow, and -1 for the up arrow, and check the box that says "relative." This means that every time up is pressed, "position" decreases by one, and every time down is pressed, it increases by one.

If you run the game now, it will get an error, because the variable "position" has never been created. So what we need to do is set up a "create" event for the cursor object. In the actions for it, set the variable "position" to 0. Do NOT check relative on this one. Now it won't give you any errors, but it won't do anything yet either.

Before it will do anything, we need to tell the cursor where it should go on the screen for each value of "position." Create a "step" event for the object. We're going to be some actual GML coding here. It's possible to do it with drag and drop controls, but a bit tedious. Before we start, we need to figure out exactly where the cursor needs to move. Because each option on mine is 32 pixels tall, the formula I will use is:
CODE
y = 346 + 32*position

346 is the starting position of the cursor on mine. Yours might be different. The X may or may not need to change, based on the layout of your title. Now pressing the arrows will visibly move the cursor. But wait! The cursor can move past the end of the option list. So go back into that same code you just added, and add this at the beginning:
CODE
if (position < 0)
    {
        position = 2;
    }
    if (position > 2)
    {
        position = 0;
    }

This will make the cursor "wrap around" when it goes outside the allowed positions.
Give it a test run. The cursor should move pretty much perfectly now.

Now we're going to make the choices actually do something! New Game and Quit Game will be the easiest, so let's cover those first. Create a key press>enter event. This will be used for all of them. Add a "test variable" action. Set the variable to position and the value to 0. Go ahead and add start- and close-blocks after it. Copy and paste this whole set, with the variable check testing for 0, 1, and 2. For 0, inside the block you simply put in a transfer to the room to start the story in. For 2, you simply end the game. You'll want to make another room to test the "new game" one.

Loading is going to be the weirdest one to implement, because there are simply so many different ways to implement loading. I'm going to assume that you're only using one save file, and that you're using Game Maker's default saving function. Now, there is something a little odd about how Game Maker saves work. If the player does the built in save with F5, it names it something like _save684483.sav. This is not good for easy loading unless you want the player to type in the name of the save game. Instead of having the player use f5 to save the game, you should set up your own saving system using the game_save(filename) function or drag and drop action. Make sure you remember the name of the save that will be used. Stick a "load game" action in the block for position=1. Use the same file name that your save games will use.

If you want to use the default F5 saving, you could have the "load" button simulate an f6 press. To do this, add this in an "execute code" action instead of the load game:
CODE
keyboard_press(vk_f6);


[Show/Hide] Here's what my GM screen looks like with a few random windows open



The basic stuff should work like so. There are a few things that we missed, though. We need to add music to the title screen, and have it end when new game is pressed. Well, why not just stick the music start in the create event of the cursor, and the stop in the enter key event? It's as easy as it sounds. In the create event, add a "play sound" action, and in the enter event, add a "stop sound" action. Don't put the stop sound within any of the blocks. If you want to add animations to your title screen, just find some gifs or sheets you like, import them, and stick objects around the title (don't do it to much or people may hate you for it).

If you want to add more options to your menu, it's quite easy. Just us a different "options" image, and change the max number of possible positions for the cursor.

Having multiple save files could wind up being a little bit difficult. You'd need to create another room that displayed a list of all the possible save files, and process what to do for each one.

DEMO:
http://www.mediafire.com/download.php?mokzyunzz2w
Reason for edit: Messed up topic title


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   
Rukiri
post Jun 1 2009, 07:43 PM
Post #2


emerge -avt awesome! Wait... it brings me.... HERE?!
Group Icon

Group: Revolutionary
Posts: 1,725
Type: Scripter
RM Skill: Advanced




Should help newbies out a lot, you did more than you honestly had to though...


__________________________
Xeilsoft
- Follow your dreams to the very end..

Kits that I'm working on.
[Unity3D 4.0] LTTP/Minish Cap - I don't have time for custom gfx like what the pze folks are doing but I will try and work on some enhanced LTTP graphics.

Main PC
Core i7 3820 overclocked @ 4.8GHZ
Galaxy: Nvidia Geforce GTX 680 GDDR5 2GB
Asrock X79 Extreme9 w' creative sound
64GB corsair platinum @ 1600MHZ
Muchkin 128GB SSD(boot), OZKIN 2TB SSD, Western Digital GREEN 1TB HDD.
Rosewill Lightning 1000W PSU
OS: Funtoo Linux, Windows 8 (Virtual Machine)

iMac (March 2013)
3.4GHz Quad-core Intel Core i7, Turbo Boost up to 3.9GHz
16GB 1600MHz DDR3 SDRAM - 2X8GB
1TB Serial ATA Drive @ 7200 rpm
NVIDIA GeForce GTX 680MX 2GB GDDR5
Go to the top of the page
 
+Quote Post
   
HeroOfHyla
post Jun 2 2009, 10:45 AM
Post #3


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




Well my goal was to create one from scratch, using as little scripting as possible, and without assuming that the users were already using some other type of selectable window that could be adapted to this.


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 08:25 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker