Previous Blog Next Blog
Prev/Next Blog
by date

Making an arcade style high score name entry screen

Making an arcade style high score name entry screen
Name:Manjit Bedi 
Date Posted:Jun 13, 2007
Rating:3.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Manjit Bedi

Blog post
The game I am working on will ultimately be in an arcade cabinet and using a joystick and buttons.

I have spent the last day and then some tinkering with making a name entry screen. The idea is something very classic in design. I thought it was about time that I gave something back to the TGB community. :-)

Here is what I mocked up some far:



This is really just something functional, it is bound to get some graphical flourishes later.

Basically, what I did was create a series of text objects and then when the level is loaded; I stored the objects in an array. I keep a position for the 'cursor' which is x, y pair which I use to get the text objects from the array. I have move maps set up for the direcitonal arrow key and when the space bar is pressed.


	%this.letters[0, 0] = letter11;
%this.letters[1, 0] = letter12;
%this.letters[2, 0] = letter13;
%this.letters[3, 0] = letter14;

etc....

// update position of cursor
%letterObj = %this.letters[%this.cursorPosX, %this.cursorPosY];
echo("move cursor to" SPC %letterObj.getName() SPC "with position" SPC %letterObj.getPosition() SPC "letter" SPC %letterObj.text);
%pos = %letterObj.getPosition();
$cursor.setPosition(%pos);

// Now for some fun, display the letter in the name text object.
if(%letterObj.getName() !$= "delLetter" && %letterObj.getName() !$= "endName" )
{
%character = %letterObj.text;
%this.nameLetters[%this.lettersUsed] = %character;
HighScoreName.text = %this.nameLetters[0] @ %this.nameLetters[1] @ %this.nameLetters[2] @ %this.nameLetters[3] @ %this.nameLetters[4] @ %this.nameLetters[5];
}

etc...


There are two special text objects: one for deleting the last letter and the other for ending the high score entry. I check the name of the text object to see it is one of them.


/*
Given the current cursor position use the letter.
*/
function nameEntryClass::selectLetter(%this)
{
%letterObj = %this.letters[%this.cursorPosX, %this.cursorPosY];

if(%letterObj.getName() $= "endName")
{
// store the name in a global and switch to the high score table
}
else if(%letterObj.getName() $= "delLetter")
{
if(%this.lettersUsed > 0)
{
%this.nameLetters[%this.lettersUsed] = "-";
%this.lettersUsed--;
HighScoreName.text = %this.nameLetters[0] @ %this.nameLetters[1] @ %this.nameLetters[2] @ %this.nameLetters[3] @ %this.nameLetters[4] @ %this.nameLetters[5];
}
}
else if(%this.lettersUsed < 6)
{
%this.lettersUsed++;

%character = %letterObj.text;
%this.nameLetters[%this.lettersUsed] = %character;
HighScoreName.text = %this.nameLetters[0] @ %this.nameLetters[1] @ %this.nameLetters[2] @ %this.nameLetters[3] @ %this.nameLetters[4] @ %this.nameLetters[5];
}
}


And here is the code:

TGB high score script
Level file download

Note: I make reference to an image map for the cursor and background shapes. Everything else are just text
objects.

Recent Blog Posts
List:09/15/07 - Update on the game project
06/13/07 - Making an arcade style high score name entry screen
05/23/07 - Next steps - getting TGB into an arcade cabinet
04/21/07 - Experimenting with weapon collision and using mounted objects

Submit ResourceSubmit your own resources!

Andy Hawkins   (Jun 13, 2007 at 15:26 GMT)
I've fixed your links up. The '[url]=' should have been '[url='...]Label'[url]' etc...(remove the apostrophes for it to work)

TGB high score script
Level file download

By the way - I'd like to use this for my BRAVE game if that's okay ?
Edited on Jun 13, 2007 15:27 GMT

Tank Dork   (Jun 13, 2007 at 17:11 GMT)


Here is the image you wanted to show.. you need to end with [/image] :)
Edited on Jun 13, 2007 17:12 GMT

Leroy Frederick   (Jun 13, 2007 at 17:48 GMT)   Resource Rating: 3
Nice retro look! I use the profile name for top ten scores, so there isn't any need for the player to enter another name at any point.

I'm curious, is this intended for xbox device/controller users only (hence the red button comment), otherwise asking potential pc/mac users with say, I don't know, a standard 'stroke' cheap gamepad with numbers/letters instead of colours, could cause a bit of a problem, no? (ignore this if your not planning to final release with that text)

Anyhow, I suppose this is easy to change/adjust from script so therefore nice resource! :0)

Manjit Bedi   (Jun 13, 2007 at 18:26 GMT)
Thanks guys for the fixes. D'oh.

And yes feel free to use the code.

M.

Manjit Bedi   (Jun 13, 2007 at 18:34 GMT)
In reply to Leroy's question about the help text.

The game is going to into a cabinet and there will be a USB joystick and it looks like 4 buttons. We have not decided on the button colours. But there is bound to be a red one. :-)

The game will have an attact mode which will go between a few animations, a help screen and high score table. I plan to blog a bit about the game structure in another post.

Cheers.

M.

Leroy Frederick   (Jun 13, 2007 at 23:02 GMT)   Resource Rating: 3
Quote:

into a cabinet
Arcade style huh, cool! :0)

You must be a member and be logged in to either append comments or rate this resource.