Jump to content

Space Shooter, Java 2D game

- - - - -

  • Please log in to reply
5 replies to this topic

#1
Cander

Cander

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts
I just released my new game "Space Shooter" programmed in Java, that I throwed together as a project in a programming course. It is homemade for sure, but its definitely entertaining for a while :-)

Posted Image

Download (~8MB): http://web.it.kth.se...hooter_v1.0.zip

Requires Java's JRE 6 (which is standard these days so you most likely have it installed) and can be run on all OS supported by Java (Windows, Linux, Mac, etc...).

Enjoy, my high score is so far 2:45. The difficultness is set so 3 minutes is really hard to reach.

Feedback on the game is appreciated!

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java

Quote

my high score is so far 2:45
Screenshot or didn't happen :P

I don't quite understand the powerups / bonuses. Sometimes nothing happens when i catch one.
But very cool game tho :c-^_^:

#3
Cander

Cander

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts

wim DC said:

Screenshot or didn't happen :P

I don't quite understand the powerups / bonuses. Sometimes nothing happens when i catch one.
But very cool game tho :c-^_^:

When you make the game you need to test it like a thousand times, you get somewhat a pro at it eventually. I'll post a pic next time I play and achieve a decent score. :-) The key to clean the enemies in late game is to pick up the orange item boxes and get Splash Waves to use at the high hp destroyers (gray enemy).

What I think your referring about items why sometimes nothing happen when you drive over one. You can only have one (1) item stored in your container at the time. When you get a item, a popup message will say what it is and a sprite of the item will be drawn in your itembox container in the panel. You can then use it by pressing the Use Item button. If you already have a item and drive over another one, nothing will happen but it just disappear (small explosion). See the README file for what items that exist in the game and what's their function if your interested.

Btw to say, even though I tried to balance it well, I think it is easier to survive longer when playing 1 player even though in 2 player mode only ~1.7 times more enemy spawns. It gets so much bullets everywhere which is hard to avoid.

#4
Cander

Cander

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts
Posted Image

You must get lucky in the end with item spawn to make it to 3 minutes, normal bullets can't beat this pack really. :-)

#5
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
ooooohh right i totally forgot about the bonus actvator button :c-biggrin:

Are the sprites images or drawn with the graphics (circle, 2 triangles, 2 rectangles)?
If it's an image.. how did you rotate it? I once did it, but had to use a rotationmatrix and thought it was too complicated for a simple rotation...

#6
Cander

Cander

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts
No images! I tried it once, but as far I came it was worthless when you wanted to add rotation, scaling etc.

I have for most sprites used GeneralPath, very handy class which let you basically draw any type of complex shape you want. Other from that I used Ellipse2D when I wanted circles and Rectangle2D when I wanted rectangles.

You maybe just were interested of image rotation, but here is how I did it with my Shape objects. This is the super draw method for ships, bullets and itemboxes that handle rotation and scaling. The spriteArea variable that I updated here is later used for collision detection.

public void draw(Graphics2D g2)
    {
        AffineTransform transformer = new AffineTransform(); //temp variable for keeping track of the rotation and scaling
        
        transformer.rotate(rotationAngle, getPosition().x, getPosition().y);
        transformer.translate(getPosition().x, getPosition().y);
        transformer.scale(scale, scale);
        transformer.translate(-getPosition().x, -getPosition().y);
        
        spriteArea = new Area(spriteBody);
        spriteArea.transform(transformer); //transform like shape
        
        g2.setTransform(transformer);
    }

Then for instance, the draw method for the Bullet class
    public void draw(Graphics2D g2)
    {
        super.draw(g2);
        
        g2.setColor(getSpriteColor());
        g2.fill(getSpriteBody());
    }





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users