Sign in to follow this  
  • entries
    686
  • comments
    1952
  • views
    386230

Space Trucks

Sign in to follow this  
Stompy9999

92 views

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.
Sign in to follow this  


4 Comments


Recommended Comments

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].

Share this comment


Link to comment
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.

Share this comment


Link to comment
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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now