Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nonnus29

[java] My New Applet now online

This topic is 5979 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 posted this on the announcements a while ago but its probably more applicable here: I have a new applet on my website: Asteroids! You can check it out at: www.geocities.com/nonnus29/index.htm I''m interested to know how it runs on IE 6, so if any XP users out there wanna test it that would be great. Its not quiet polished yet, but i''m not going to work on it anymore, on to bigger and better things! (the only thing I would add is a 2 second period of invulnerability so you can survive when hit by a big asteroid) As always, the source is freely available, just email me. Or if there is enough of a demand I could put it on the site somewhere.

Share this post


Link to post
Share on other sites
Advertisement
It runs about a billion FPS... the ship makes about 20 full rotations before I can let go of a turn key!

IE 6 in Win 2K.

-M

Share this post


Link to post
Share on other sites
I''d be some kinda genius programmer to get that kind of fps outta java 1.1, thats fo'' sure. I took the easy road; in my mainloop I use thread.sleep(REFRESH_RATE); as is it is set to 40 millisecs. Keeping in mind that I only have eight frames of animation for the ship and asteroids its no surprise it spins kinda fast. I tried adding a framecounter to the ship class to slow down the rotation but it was just too slow. On one browser I tried I got really erratic drawing of the applet; it was this hokey browser that came on my dell, half the time all the asteroids disappeared. But on ie 5.5 it runs fine.

Thanks for the input. I''ll see what I can do.

Share this post


Link to post
Share on other sites
Head over to javagamin.org and look for the timing code there ( i think it was an thread re: pac-man remake ). The game frame 4 java codebase also has a good all os timer.

Basicly it works by keeping time in a seperate thread and then just calling notify evey x ms. The better ones have a feedback loop that can adjust for slight abnormalities over time. I have written several over the past two years. If you are having trouble post another comment and I''ll see what I can do to help you along.

Share this post


Link to post
Share on other sites
It turns really fast because his ship only has 8 frames of animation (and 8 directions of movement). furthermore, there is no use of sin and cos it the velocity computations:

public void rotate(int i)
{
if(i == 1)
{
frame++;
if(frame > 7)
frame = 0;
}
if(i == 0)
{
frame--;
if(frame < 0)
frame = 7;
}
}

public void thrust()
{
switch(frame)
{
default:
break;

case 0: // '\0'
if(super.dy > -10)
super.dy--;
break;

case 1: // '\001'
if(super.dy > -10 && super.dx < 10)
{
super.dy--;
super.dx++;
}
break;

case 2: // '\002'
if(super.dx < 10)
super.dx++;
break;

case 3: // '\003'
if(super.dy < 10 && super.dx < 10)
{
super.dy++;
super.dx++;
}
break;

case 4: // '\004'
if(super.dy < 10)
super.dy++;
break;

case 5: // '\005'
if(super.dy < 10 && super.dx > -10)
{
super.dy++;
super.dx--;
}
break;

case 6: // '\006'
if(super.dx > -10)
super.dx--;
break;

case 7: // '\007'
if(super.dx > -10 && super.dy > -10)
{
super.dx--;
super.dy--;
}
break;
}
}


[edited by - bslayerw on July 29, 2002 11:46:22 PM]

Share this post


Link to post
Share on other sites
bslayer-yep thats about it. I wanted to use gifs and not vector graphics so I compremized on the rotation rates. I''m going to leave it as is and move on. Thanks for the input everyone.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!