Results 1 to 2 of 2

Thread: 1st Game

  1. #1
    Join Date
    Sep 2010
    Posts
    1
    Rep Power
    0

    Default 1st Game

    I am creating a shooting game which involves a spaceship (the shooter) and asteroids (the target). I managed to display the spaceship the way I want and I am also able to move it on the screen using the keyboard the way I want. However, I am having problems loading the asteroids. I am using a timer to do the animation. Here's what I am trying to do with the asteroids: I want there to be 4 asteroids coming down the screen (from top to bottom). When one of the asteroids has reached the end of the screen, 4 more asteroids come down (at random positions on the screen). I have one timer object which calls the paintComponent() method every 25 milliseconds. Although this works fine for the movement of the spaceship and the firing of the bullets, it's way too fast for the asteroids (meaning the asteroids come down so fast). So, I was wondering whether it would be possible for the bullet animation to occur at a different speed then the asteroid animation (i.e. for the asteroids, I don't want the timer to call the paintComponent() method every 25 ms).

    Thank-You in advance.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I know nothing about games, so hopefully a game pro will come around to help, but I would think that you could give each moving object a speed, perhaps an x and and a y speed, and using the system clock and these speeds, move only a certain distance for each slice of time.

Similar Threads

  1. Replies: 2
    Last Post: 08-05-2010, 04:49 AM
  2. game code for any game
    By deathnote202 in forum Java Gaming
    Replies: 4
    Last Post: 06-10-2010, 08:06 AM
  3. Help with my game!
    By Manikyr in forum New To Java
    Replies: 6
    Last Post: 06-06-2009, 11:09 AM
  4. 2D strategy game or 2D war game
    By led1433 in forum Java 2D
    Replies: 5
    Last Post: 02-10-2009, 06:00 AM
  5. game
    By amith in forum AWT / Swing
    Replies: 0
    Last Post: 05-19-2008, 05:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •