Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8096603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:30:17+00:00 2026-06-05T21:30:17+00:00

Perhaps a question with a simple answer. I’m trying to animate a ship (asteroids

  • 0

Perhaps a question with a simple answer. I’m trying to animate a ship (asteroids style). Right now I’m just using the Graphics2D rotate method. However, right now it’s just blurring my image. What’s the simplest way of going about this and getting it to work correctly? (the getImage method gets called every time the screen refreshes, and the rotate method gets called every time the user presses left or right. bi1 is the bufferedimage read in previously)

public void rotate(double rot) {
    g = bi1.getGraphics();
    Graphics2D g2d=(Graphics2D)g;
    g2d.rotate(rot, 15, 15);
    g2d.drawImage(bi1, 0, 0, null);     
}

public BufferedImage getImage() {   
    return bi1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:30:18+00:00Added an answer on June 5, 2026 at 9:30 pm

    try it using an affine transformation:

      public void paint(Graphics g) {
          // clear off screen bitmap
          super.paint(g);
          // cast graphics to graphics 2D
          Graphics2D g2 = (Graphics2D) g;
          AffineTransform tfm = new AffineTransform();
          tfm.rotate(0,0,0);
          g2.setTransform(tfm);
          g2.drawImage(backImage, 0, 0, this);
          tfm.rotate(Math.toRadians(player.angle+90), player.x+32, player.y+32);
          g2.setTransform(tfm);
          g2.drawImage(tank, player.x, player.y, this);       
      }
    

    http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/geom/AffineTransform.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty simple question, perhaps not so simple answer though: I've got a clear view
Simple question here (though perhaps not such a simple answer): Is it possible to
Perhaps the Question isnt that simple to answer... but what is your opinion? Should
I have a pretty simple question which perhaps someone familiar with Server/Client design &
Perhaps a simple to be answered question, but I did not find a satisfying
i have a (perhaps stupid) question: im using 2 threads, one is writing floats
This question is just out of interest, and perhaps could be useful for my
A simple question, perhaps, but I can't quite phrase my Google query to find
I have been looking everywhere for an answer to this question - perhaps I'm
I feel like the answer to this question is probably very simple, but I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.