Tutorial 3 Part 2
If the text output of the
previous tutorial was too basic for you, and you wish to have fancier text, take a look at this tutorial. We will be using pre-drawn sprites for our text.
Download this zip file (
numbers.zip (6kb)) containing images of numbers and extract the files into a directory on your hard drive eg. "C:\TSS Dx-Creator\Tutorial3b\". Create a new project in this directory, putting a black 640 x 480 background image in bank 1.
At the moment the individual images of numbers aren't very useful to us. We need to make a sprite sheet from them. There is a very easy way to do this with the Sprite Sheet Wizard.
From the "Tools" menu, select "Frame Creation" then "Frame Wizard" to run the Sprite Sheet Wizard. Click on the Plus icon and select the 10 images you downloaded earlier. Make sure that they are in the same order as they appear on your keyboard, in other words 1,2,3...8,9,0. The best way to do this is to add the images 1 to 9 and then add 0 afterwards. Select Next to continue.
On the next screen leave Automatic selected, and click Next.
On the next screen leave Autosize selected, and click Next.
On the next screen take a look at the preview image, and, all being well, select save. Save the sprite sheet into the same directory as the project. Click finish to end the Wizard.
Add the sprite sheet to bank 2 of your project. Now create a sequence in bank 3 using the sprite sheet you just created and these values: Sprite X = 30, Sprite Y = 30, Sprite Count = 10, X Count = 10.
Finally enter the following code into your project :
NOTE: If you do not wish to type the code below you may download or open this text file and simply copy and paste the code into your project.
Global KEYPRESS
DefProc INIT_DISPLAY()
DefProc CREATE_SPRITES()
DefProc CHECKKEYS()
INIT_DISPLAY()
CREATE_SPRITES()
Repeat
KEYPRESS = 0
Update Display
KEYPRESS = ScanCode()
If KEYPRESS > 257 And KEYPRESS < 268 Then
EndIf
Until KEYPRESS = 1
Procedure INIT_DISPLAY()
Create Map 640,480,1,1 In Bank 50
Set Tile 0,0,1 Using Bank 50
Create Plane 1 Using Bank 50
EndProc
Procedure CREATE_SPRITES()
Create Sprite 1,288,208 Using Bank 3
Sprites On
Sprite Animate 1 Off
EndProc
Procedure CHECKKEYS()
SetSequenceFrame(1,KEYPRESS-257)
Sprite On 1
EndProc
EndProg
|