Sign in to follow this  

[java] Galaga Clone

This topic is 4734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a clone of Galaga -- I'm sure there is one out there, but I want to design it on my own, the architecture, everything. I started it last night, and, I've come to point where I need to decide to do transparent images, or 2D objects, as per a Java2D scheme. I've been toying with the AI idea and have been wonderring if its going to kill frame rate if I regenerate each of the aliens geometry every single game loop. But with images I would need to create several images at increments of angles, and then scroll through those. The geometry sounds more flexible, as I could maybe reuse some of the code afterward. Anybody have some suggestions or comments? L-

Share this post


Link to post
Share on other sites
Best use a memoryImageSource, where you can actually work pixel based. You could then access the array where your enemy is stored at any angle, and then probably the geometry can be an advantage. If however you go for images, you should know you can draw an image rotated, so there's no need to create your art at incrementing angles. As for performance, I would not worry about it, if you implement it well, there's no issue drawing 50 or so enemies.
Furthermore, great idea, one of the best games around in my opinion!

Share this post


Link to post
Share on other sites
I've never done this -- for a game, and I have read all of Java2D, so I have some reference material. I was thinking of trying to access the array of pixels and saving a copy of the pixels underneath the enemies, and then repaint them after the image moves or whatever. This is slightly unneccessary as I started to think about the game, because in Galaga, there is little, to know overlap of graphics. But, I'm curious, is this possible with the memoryImageSource, and the ImageBuffer stuff ?

L-

Thanks for the reply, by the way. I will post a link to the source, with Ant build file, and everything, when it is finally done -- it probably won't be for a while though, because I won't be able to work on it in the next few weeks, and then school starts again, but I figure an hour or three a day, even during school might eventually see it done.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by tjoink
Best use a memoryImageSource, where you can actually work pixel based. You could then access the array where your enemy is stored at any angle, and then probably the geometry can be an advantage.


Bad idea - this prevents your graphics card from doing hardware acceleration. OK, it's only Galaga...but why waste all that hardware?

In general, you want to blit images. It's easier, it's MUCH easier to edit the images / get someone to give you free artwork etc, and it's very fast.

FYI you should be able to blit thousands of images PER FRAME without problems. I.e. tens or hundreds of thousnads of images per second...

Although you ought to get v.high performance from drawing using primitives, there are some annoying bugs in Sun's java that you have to workaround. If all you're doign is blitting images, there's so little to go wrong that there aren't any bugs. (OK, there are two bugs when trying to load images from disk, but they have one-line workarounds).

redmilamber

Share this post


Link to post
Share on other sites

This topic is 4734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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