MAGIC...er...which day is it again?

Published June 09, 2007
Advertisement
Action screenshot:


So yeah, the player is now in the game, and the gameplay has taken shape. Like I hoped, the game makes it easy to break ice and press switches, and less easy to single handedly fight a bunch of enemies. If I can design some good levels, than it should be quite a bit of fun.

Also, I need to come up with a name for it. I'm thinking something like "Trouble in the Tower", but I don't know.

Since this has been the longest I've worked with XNA on a single project, it's been quite a learning experience. I've learned, for instance, that it's probably better to use sprite sheets rather than individual files for each sprite, so I only have to apply the alpha background once. I've learned things about XNA that will help when I start working on my sidescrolling beat-em-up project after Blocky Man.

I can't seem to figure out how to read from files in C# or XNA, so I figure I'll just hardcode the maps for this game. In either case, I need to find out a way to do it tonight, so that I'll be able to get the game ready for submission tomorrow. The game is in no sense polished, but it's playable and interesting.
Previous Entry MAGIC day 3 & 4
0 likes 3 comments

Comments

mldaalder
While not having programmed in either XNA or C# (well, that that much anyway) and I seriously want to keep away from VB (I don't know, it isn't that it's an "easy" language, it's just incompatible with me :P).
I would suggest looking into the "package" System.IO
June 10, 2007 04:30 AM
Aardvajk
Quote:Original post by Stompy9999
I can't seem to figure out how to read from files in C#.


System.IO.StreamReader is pretty easy to use if you want to read text files. You just instatiate one with like:

StreamReader sr=new StreamReader("map.txt");

then you can use sr.Peek() or sr.Read() to read single characters. They both return -1 for EOF.

Obviously it provides a wealth of more higher level reading methods, but based on the two above it's possible to parse a text file in any way you want.

Someone here (Rav, I think) suggested to me reading the whole text file into a string then using the C# regular expression library to parse it. I'm sure they're right but I haven't looked into it yet.
June 10, 2007 03:12 PM
Stompy9999
I'll have to look into it after the contest. I thought I wouldn't have enough time before to learn it, but I probably could have. Now I ended up hardcoding the levels, oh well[grin]

Quote:Someone here (Rav, I think) suggested to me reading the whole text file into a string then using the C# regular expression library to parse it. I'm sure they're right but I haven't looked into it yet.


This was what I was thinking of doing, because it doesn't look as easy to parse a file in C# as in C++. I've gotten so used to using C++'s file streams that anything else seems so much harder.
June 10, 2007 03:36 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement