Game Development Community

dev|Pro Game Development Curriculum

Making an arcade style high score name entry screen

by Manjit Bedi · 06/13/2007 (7:54 am) · 6 comments

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:

www.manjitbedi.co.uk/LaiussFolly/high_score_name_entry_v0.8.png
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.

About the author

Been making mobile iOS apps mostly in UI Kit. Been doing a few game related projects more recently.


#1
06/13/2007 (8:26 am)
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 ?
#2
06/13/2007 (10:11 am)
www.manjitbedi.co.uk/LaiussFolly/high_score_name_entry_v0.8.png
Here is the image you wanted to show.. you need to end with [/image] :)
#3
06/13/2007 (10:48 am)
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)
#4
06/13/2007 (11:26 am)
Thanks guys for the fixes. D'oh.

And yes feel free to use the code.

M.
#5
06/13/2007 (11:34 am)
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.
#6
06/13/2007 (4:02 pm)
Quote:into a cabinet
Arcade style huh, cool! :0)