2

I'm making a simple sidescrolling game in JavaFX, and have done a bit of research. However, before I get really started, I wanted to make sure I was using the conventional way of creating a game. I had the following idea:

Player Characters/Enemies will extend StackPane
The levels themselves in which the players, background and enemies exist will extend Scene.
Key presses will be handled in the Level Scenes themselves, which will call the move command which exists in the player character class.
The player character will be using a custom gif image, and will use TranslateTransition for the animation of moving when keys are pressed.

Are there some obvious flaws in this approach? One thing is, I won't be using CSS, and will be raw coding the game for practice.

4

1 回答 1

1

看起来不错,除了从 Scene 扩展关卡。

你真的不需要在这样的应用程序中改变场景,只需要场景的根。因此,从 Pane 或 Parent 扩展级别并切换它们Scene#setRoot()以避免您不需要的类中的额外内容。

于 2014-08-31T17:26:57.577 回答