Sparx WIP

Nice game!
It may just be my eyes, but it seems that the bullets don’t quite move in the direction they’re pointing sometimes. For example, they seem to be pointing North-North-East when they’re fired due North. Perhaps you’re rounding in the wrong direction when mapping from an angle to an image?
Simon

+1 positive feedback here, well done :slight_smile:

Cas :slight_smile:

Thanx for all the feedback :slight_smile:

Updated to v0.7

-Better graphics
-Better enemy bevior
-General Performance/Game tuning

www.sparx.dk

Suddenly runs at hundreds of frames per second, unplayable :confused: What did you change?

Cas :slight_smile:

only 2ms sleeptime,
Before i calculated the sleeptime each frame, so i could get a stable frame rate, was not sure if it worked, but will change it back right away…

Calculate sleeptime for each frame again.

Put a frame counter on, but are getting some very unstable readings.

    public static final int FRAME_RATE = 80;
    public static int sleepTimeMs=1000/FRAME_RATE;
private int frameTime=1000000000/FRAME_RATE;


public void paint(Graphics g){
long startTime = System.nanoTime();
Graphics2D g2d=(Graphics2D)g;

	Color c=game.getBackgroundColor();
            
	if(c!=null){
		g2d.setColor(c);
		g2d.fillRect(0,0,getWidth(), getHeight());
                    g2d.setColor(Color.RED);
                    g2d.drawRect(0,0,getWidth()-1,getHeight()-1);
                    
                    
	}
	game.paint(g);
	long estimatedTime = System.nanoTime() - startTime;

                          
            sleepTimeMs=(int)(frameTime-estimatedTime)/1000000;
            if (sleepTime<1){sleepTime=1;}
            
}

    public void run() {
    	while(true){
            long startTime1 = System.nanoTime();
                
    		if(!gp.isPaused()){
    			gp.repaint();
                    }
    		try{
    			sleep(sleepTime);
    		} catch (Exception e){
    			e.printStackTrace(System.err);
    		}

            
            long estimatedTime1 = System.nanoTime() - startTime1;
            
            Sparxx.fps=(1000000000/estimatedTime1);


    	}

Thread.sleep(x) will not reliably sleep x millis, maybe that is causing the trouble? For example, I’ve found that on some windows computers, calling sleep(1) actually sleeps for 20ms.

Some people just always do sleep(1) between frames and use variable time-step updates,
others do Thread.yield() or Thread.sleep(0) in a loop until the current time is greater than whatever delay they want.

Hope that helps.
Keith

Thanks alot keith, you just saved my day :wink:
That solved my timing problems, and the slowdowns.

Jacob

Looking good! ;D

You should avoid spawing enemies near/over the player. Every time I died, I died that way. >:(

Please could you provide an URL to a screenshot? I need it to put your game into the Java™ Game Tome.

Just updated the game, the engine is much more versatile now, will take some screenshots tommorrow.

I am probably gonna add some kind of leveling, and some challenging stages (like in galaga), where i lock the aim at a given position, and the player, have to rotate about it to hit the enemy, because thats the way i usually play it(only using the aim a little, but circling around it with the spaceship, to direct the bullets at the enemy, and thats way more fun than standing still and using the aim!!!), but i found out most people just stands still and use the aim, and that is pretty boring… so i have to find a way tomake people play it the fun way…Matbe i could also add some bombs that freeze the aim, making the player move around more.

Beautiful game. Particles are lovely, different enemies are nice and it all feels very polished. It seemed a little bit easy as it stands tho, I got bored before I died. Need to have to move more.

Loving it so far tho!

Kev

Thanx Kev, actually started up game programming, reading your space-invaders tutorial to get an idea of game programming basics :slight_smile:

Added some multiply pick-ups to the game, when enemy sprite dies a token is left, take the token and 0.2 is added to your your multiplier.
Multiplier is used to calculate enemy point. Destroyed enemy score=score * multiplier.
This way the player is forced to move, and will hopefully make the game more enjoyable.

Its late now, got it working… but need to optimize it tommorow, some slowdowns, but plenty of room for optimization, just need to start looking for it :slight_smile:

Nice game, worked very well. Start was very easy but it got harder. I would love to see power ups and the such. One ship I thought was a power up :o but soon died trying that heh. Also maybe the multiplier should be smaller so its not mistake as a ship at the start.

Is this still a problem? I was thinking to use jpct in my next project.

nice game! loads and plays just fine here!
it took a while until i found out you can move and i never understood what the tokens are. maybe im not exploring enough, but i didnt even think of going through them.
it still could use more agression by the enemies, a lesser fire-rate or more durable enemies so i need to dodge something.

still: good work!

Finally got some time to work on the game again, hiscore is finally up now. Gonna add some music later today!

http://www.sparx.dk

Great game

Found an error. When you get a highscore holding or pressing shift causes it to make a square character.

Cool casual game.

The frame rate gets choppy and WASD aren’t working, even when I click for focus.