Elya Matsunomi

Greenhorn
+ Follow
since Jan 23, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Elya Matsunomi

I found another simple fix to this bug. Just reorder the codes in the paint() method

From this:



To this:



So, I draw the sub and main object first then draw the status information.

And this is the result:



I assume the reason why this bug happens is because paint() is slower than the timer. So, the timer updates the objects transform values in the program and paint() draws the transformation of objects. In my assumption, timer is faster than paint(), so, the timer might update the objects transform values while paint() is still drawing the objects. So, the transform values in Graphics2D gets scrambled and produces unexpected result.  
5 days ago
I fixed it, sort of. I don't know if I fix this bug for good, but what I did to fix the bug was to create another BufferedImage for the main object. So, Sub objects group has their own bufferedimage and the main object has its own bufferedimage. As of now, my image didn't flip/shear, but I'm not really sure if the bug on my program is fixed because this bug can appear abrupt and random. I don't know the cause of this bug but base on my assumption, a graphic transformation may mess up if there's too much transform operation happening in the graphic.
6 days ago
is there any suggestion why this bug happens? I hope someone can help me on this as this bug is very challenging to fix for me because this bug randomly happens. I'll try to find a way to solve this and post my solution if I fix it.
6 days ago
In the early seconds when I launched my program everything was fine but as time went by, my main Object(the animal(pokemon) in the screenshot) got this kind of strange bug where the object image sheared/flipped for no reason. I have this program that rotates 25 sub objects(gray blob in the screenshot) and a main object that can be move and rotated by the user.

Here's my screenshot:

started to launch


After 90 seconds(approx.)


When I removed the rotate code of sub objects, I didn't get the bug.

sub objects no rotation


Here's my transform code on my main and sub objects

I already commented the rotate code







I tried to change this to paintComponent and the problem still persisted.
       

6 days ago
I fixed it. First, I observed that the rotation increment in keylistener was slower than the rotation increment in the timer. So, I created a boolean flag that sets to true if the key is pressed and false if the key is released. Then, I do the rotation of the first image in the timer. If the boolean flag is true, then the first image rotates as long as the boolean flag is true and stop if false. I only apply my solution on the right rotation, though, it can be easily applied on the left rotation. This solution is not that elegant though. Is there another alternative to this solution like a mathematical formula that produces the same result?

6 days ago
Is there a way to make the rotation of an image smooth when controlling with keys in keyboard?



In this code, there are two images rotating on the screen. The first image can be rotated by pressing the "D" and "A" key while the second image is automatically rotated. In this example, the second image is smoothly rotating while the first image has a jerky feel to its rotation.

Any help/insights would be appreciated.
1 week ago
I fixed it, forgot to paint the background

1 week ago
I am trying to rotate an image in a loop, but when I do the image multiplies on the screen and stacks up on each other.


   

Result:


How do I rotate my image without multiplying?

1 week ago