Sign in to follow this  
gamechampionx

Rogue Clone

Recommended Posts

I'm a University student, doing first-year cs. I'm wondering if it would be terrible to write a Rogue clone as a java applet. The game seems easy enough to write. I have experience with OOP and inheritence, interfaces, and all that stuff. I've never done applets before though, but I know how to construct them. I'm wondering if anyone knows the ins and outs of displaying text, such as in rows and columns in an applet. Thanks a lot!

Share this post


Link to post
Share on other sites
Do you really have to write as an applet instead of a proper application? The text-based graphics are intended to take advantage of the simplicity of working with a console (and probably a console library such as 'ncurses' to do text positioning - I don't know if that's available for Java though). Once you're stuck creating your own window, it doesn't really save any effort vs. drawing actual graphics using tiles.

That said - I assume you have some background in the UI toolkit; look up the Graphics class, and particularly Graphics.drawString(). You will want to set a monospace Font for your display, create a window (or region) that is 80x25 (or whatever) characters according to that Font's metrics, and then create a Canvas representing that region, with a Graphics context that draws to it. Then update the display in the paint() method; the simplest thing would be to always paint over with a black rect, then set the colour back to white, and output all the "text" of the level (held in a byte[][], char[][] or String[]) row by row.

Share this post


Link to post
Share on other sites

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

Sign in to follow this