Space Trucks

Published August 13, 2007
Advertisement
Power-Ups, and the Space Trucks that carry them:


The Power-up effects had been programmed already, but now they can be grabbed in the level. Power-Ups appear after destroying one of the transport ships. These will appear throughout the level. In addition, transport ships will randomly appear during boss battles to give the player some help.

One thing I need to get working is a way to draw text. XNA doesn't provide any text drawing methods, so I'll have to make something of my own. It shouldn't be too bad to program, the hardest part will probably be drawing all of the characters as images.
Previous Entry Captain Ace conversion
Next Entry XNA text
0 likes 4 comments

Comments

Trapper Zoid
Text systems are always a bit finicky. I'm currently using a bitmap based approach, where every glyph is its own sprite and usually given a name like "fontname_065", where the last three digits are the ASCII code for the character. If you have a copy of my game Brixtar you can open up the SVG file in the resource PAK to see the sprite sheet.

Then it's a matter of writing your own typesetting code. I typically write a class to contain the string and sprites, and to put all the glyphs one after the other based on their widths. If you imagine yourself as setting letter blocks into a printing press it's easier to figure out how to the write the code [smile].
August 13, 2007 08:07 PM
Stompy9999
Quote:Original post by Trapper Zoid
Text systems are always a bit finicky. I'm currently using a bitmap based approach, where every glyph is its own sprite and usually given a name like "fontname_065", where the last three digits are the ASCII code for the character. If you have a copy of my game Brixtar you can open up the SVG file in the resource PAK to see the sprite sheet.

Then it's a matter of writing your own typesetting code. I typically write a class to contain the string and sprites, and to put all the glyphs one after the other based on their widths. If you imagine yourself as setting letter blocks into a printing press it's easier to figure out how to the write the code [smile].


That's exactly the approach I was thinking of. I'm just going to have a sprite for each character, iterate through a string, and draw the sprites depending on what character it is(specifically, casting the char to an integer to get its ASCII value).

I was thinking of adding some other features, for instance recognizing the newline '\n' and having the text drawn on a new line. However, I don't think I would even use that in this game.

It would be alot nicer if XNA had some sort of text rendering with TTF files, but this should be fine too.
August 13, 2007 09:01 PM
LachlanL
Hey guys.

Sprite-Font support was added in the recent 1.0 "refresh" of XNA. Here's one of the functions you use to draw a string to the screen.

Hope that helps.
August 13, 2007 11:11 PM
Stompy9999
Thanks! That certainly makes things alot easier, and I can incorporate it into my XNA framework.
August 14, 2007 12:12 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement