[Journal] TinyStarfighter

http://galaxy613.110mb.com/java/tsf_logo_lrg.png

Tiny Star Fighter

Game Specs Subject to change!
Fly around in full eight ( 8 ) directions of freedom!
Fight through five ( 5 ) sectors to stop an invading alien force!
Three ( 3 ) different types of weapons!
Two ( 2 ) nearly impossible ( ? ) to defeat bosses!

Try it! - http://galaxy613.110mb.com/java/ [Updated 5/22/10]

What I WANT it to be is a 8 direction space shooter. We’ll see how far I get. Pictures below. The “lolcept” is just a concept, the other one is where I am at right now.

Looks cool. :slight_smile:

Thanks Demonpants. :slight_smile:

Today I learned that threads are annoying. >:( Mainly a problem caused by trying to merge Markus’ framework with Shannon’s.

At anyrate, I now have all 8 directions of a space ship! Man I wish I had some webspace to show my latest stuff off on. :<

That’s looking mighty good. =D

Thanks. Hopefully I’ll have more to show soon. I just got all 8 directions of the player’s ship working and drawing. :3

Thanks to Wyrframe’s egaEditor, I have made a title screen for TSF when it’s starts or paused!

The only problem is, the image is an outside file and when I try to upload it, it refuses to load it. So I tried putting all the .class’s and the image inside a .jar file but that’s not even working on my computer. ??? Jar’s have NEVER been nice to me :-\

Does anyone have any pointers? If all else fails I’ll make the egaEditor save an array for pixels[] so I can just put it inside of my code…

Are you loading resources via the resource loader stream or by files? Files won’t work.

Also, I can’t get your applet to run. Just a white screen.

With the typical resource sizes for these games I think it makes a lot of sense to Base64 encode them into String literals embedded in code. I am writing my own paint program applet that will output a string that you can dump your code with some code for loading them. Should be done in a few days.

I’m loading the image as a file… is the a tutorial you could point me to on how to do it correctly? I’m not even sure what to Google search for to figure it out on my own. :X

The white screen is because of the current issue… I’ll upload a working version without the title screen soon.

Edit Ok I figured out a way to turn a URL into a InputStream and now I can load it using the URL to the image on my website, but it’s not loading it from a local .jar which is what I wanted to do, but it IS working if you go to the link in the first post.

For loading resource from a jar that is included in the classpath:


// The recommended way to get the classloader
ClassLoader cl = Thread.currentThread().getContextClassLoader();
// Get an input stream of the resource, assuming it is in the root directory of the jar, if it is in a subdirectory use "pathtoresource/myimage.png"
InputStream stream = cl.getResourceAsStream("myimage.png");
// Get a buffered Image using ImageIO system:
BufferedImage img = ImageIO.read(stream);

Alternatively use the applet to load the resource:


// Get the classloader
ClassLoader cl = Thread.currentThread().getContextClassLoader();
// Get the resource URL 
URL url = cl.getResource("myimage.png");
// Use the applet getImage to load the resource
Image image = getImage(url);

Alternatively use the Swings ImageIcon loading routine to get the resource, this is (or was) probably the most robust/fastest method


Image image = new ImageIcon("myimage.png").getImage();

All of these rely on the jar being included in the classpath and also using the correct path to the image.

Thanks Shannon! Now I can use the .jar like I wanted to. The only thing is I’m not using normal image files, I’m using Wyrframe’s .ega image format. But it still looks like you can open InputStreams using those methods you just posted so it’s all good and will probably help me in the future. :slight_smile:

Edit The applet on my site is updated now, you should see the neat title screen now!

Also, Eclipse is pretty friggin nice. When I rename variables I just have to hover over the old variable name and click on “Rename” and it renames all the old instances. :smiley:

Edit Revamped the test page. It’s now keeping track of how many hits it has and also looks a bit nicer.

Currently revamping how the game is setup. I was using one big tinystarfighter.java file to handle both applet AND game stuff… I’ve split the game-related stuff into Game.java that uses ALOT more functions and thus has more clearitiy than ever before. The idea was to get tinystarfighter.java as light weight as possible, and I think I’m succeeding. :smiley: After I am done with this refactorization, I’m going to get bullets working and shooting.

Edit Awesome! Everything is working on the first try… I guess this isn’t a surprise because Eclipse keeps compiling the code as I go… this might’ve not be as fun as it was if it didn’t show me errors as I went along…

Edit2 Alright, got bullets nominally working! I had to wrangle me some bugs with the bullet Iterator and destroying bullets once they got to old. I found out that you had to remove it from the Iterator, NOT within my Update() method!

Try it out! I also made the music a little faster pace… http://galaxy613.110mb.com/java/

Watched Markus program on LiveStream and gave me a lot of ideas. For one I refactored my code to use packages and folders (for instance his EgaImage class is now in the notch.graphics package) I also added in his awesome image loading code so I can load normal PNG’s and it automatically finds the closest colors! So I updated the live test in the first post with the new code. Most of it isn’t visible, but I also fixed the scrolling stars. Before they cut off after a little bit, but now they go on forever!

I still am not completely sure WHAT I want to do with this. Do I just want to make it some arcade-type game with periodical weapon upgrades? Or do I want to make it something more like EV Nova with multiple systems, docking, trading, buying upgrades, etc…

Alright, finally updated whats uploads.

No gameplay yet, but I’m slowly making my way to it. Here some concept art of what’s to come:

Gonna make it more of a arcade shooter with upgradables instead of a EV Nova clone… not enough space. Or more like, I don’t want to put up with the lack of space. Maybe after I finish this game I’ll try it…

Anyways, go visit the link in the first post and try out the new main menu and look at the in-game stats screen!

Hello Galaxy613,

Ran on:
Acer Aspire 5740, Windows 7 , Internet Explorer, jdk1.6.0_20
Mac Mini, Snow Leopard OS X, Safari, jdk 1.6.0_20
Suse 10 (Virtual Machine), firefox 2.0.0.14, jdk 1.6.0_19
HP Compaq 6820, Fedora 8, Firefox 2.0.0.10, jdk 1.6.0_04

For the Mac there was one time a situation that it crashed safari. Could not
reproduce it the second time. I think I was flying to the upper right corner and
pressed two keys simultaneously to get to the bottom right screen while I was
pressing the fire button.

I noticed that the stars are being drawn when for instance I move up. It always
takes a while before they are drawn. Maybe you are after that effect, I don’t know,
but I just noticed it.

Good luck with the rest of the project.

Best regards from

M.E.

The physics of the movement is pretty nicely done.

I’m guessing there’s some kind of mathematical miscalculation as to what stars are shown, but they seem to be drawn in the right place when they do get shown. shrug (The problem referred to by M.E.)
In the worst case scenario it seems the ship has to pass the star tile before it gets drawn, or when flying in the opposite direction it disappears when the ship flies past it. And it only seems to happen when flying far to the top left (both the top tiles and the left tiles disappear early), but I haven’t tested it extensively.

When I’ve done space shooters, I just use some simple particles with positions relative to the viewport (local/relative, not global/absolute positions), it really simplifies the wrapping.