0
\$\begingroup\$

I have an object in my game that moves pretty slow, a bit under a pixel every second. When the object is moving at this speed, it looks pretty choppy, because it only moves once every second.

Is there any way that I could blend the movement so that it moves at say 1/8th of a pixel every 1/8th of a second through the use of possibly anti-aliasing? Is there a way I could create a smoother transition between the two frames that makes it look like the object is consistently moving rather than moving a pixel every second?

I am currently using a float system for all of my positions and velocities, however I do not know how to render the image using floats. I am currently using java.awt.Graphics drawImage, which uses integers, rather than floats.

\$\endgroup\$
1
  • \$\begingroup\$ Are you able to Photoshop a screenshot what it would look like if it was moved .25 pixels? I assume you work on low resolution so pixels are that obvious? \$\endgroup\$ Commented Jul 30, 2016 at 6:39

1 Answer 1

0
\$\begingroup\$

Your question is quite broad, so here's broad answer: Store object position and render it using floats instead of integers.

\$\endgroup\$
4
  • \$\begingroup\$ I am using floats to store the positions and velocities of all of the objects. I am just unsure as to how to render them in the float format. I am currently using graphics.drawImage(Image image, int x, int y, ImageObserver observer). How would I render an image using floats? \$\endgroup\$ Commented Jul 30, 2016 at 11:35
  • \$\begingroup\$ @CamH: See, that kind of details should have been in the question from the start. Do you have other ways of drawing using floats ? \$\endgroup\$ Commented Jul 30, 2016 at 11:45
  • \$\begingroup\$ @CamH Does this looks familiar? stackoverflow.com/questions/8676909 \$\endgroup\$ Commented Jul 30, 2016 at 11:46
  • \$\begingroup\$ Just looked up how to draw using floats, and found an answer, thankyou for your help! Here is the article I found useful for others interested: stackoverflow.com/questions/8676909/… \$\endgroup\$ Commented Jul 30, 2016 at 11:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.