Smooth fast move and repaint()

后端 未结 2 766
天涯浪人
天涯浪人 2021-01-15 10:52

I\'m writing easy space invaders and have a problem with moving ship. Basically I change position of ship and then repaint(). If the change is big it is more li

相关标签:
2条回答
  • 2021-01-15 11:35

    Please post some code? Is the whole game running inside a canvas or is every ship a JComponent? For games I would use JavaFX or a game engine like http://jmonkeyengine.com. To create smooth animations in Swing you can use a animation framework:

    • http://java.net/projects/timingframework
    • http://kenai.com/projects/trident/pages/Home
    0 讨论(0)
  • 2021-01-15 11:45

    The Space Invaders - 2D Rendering in Java tutorial may be helpful as an example using an explicit BufferStrategy.

    0 讨论(0)
提交回复
热议问题