Having trouble creating an unbound game #1284
-
Hello dear developers, I am trying to recreate a game like Splix.io using FXGL, I have implemented the logic of the game for one player and it works. As you know Splix.io has a gird like board so to create this grid I created Light Gray cells of 20 pixels like this:
and this is how I initialize the game board at the start:
Can someone tell me how I can make this fixed size game unbounded? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, this sounds like a logic question, rather than an FXGL-specific question. I think it ultimately boils down to a data structure problem. My first thought is to go for something like a As far as the implementation related to FXGL goes, you can use |
Beta Was this translation helpful? Give feedback.
Hi, this sounds like a logic question, rather than an FXGL-specific question. I think it ultimately boils down to a data structure problem. My first thought is to go for something like a
Map<Point2D, cell data>
that allows you to keep track of all cells in the game and update as appropriate. Alternatively, you can try finding some resources on different ways to store your grid.As far as the implementation related to FXGL goes, you can use
getGameScene().getViewport().bind...
to bind the viewport to yourplayer
entity, which will solve all the movement and camera problems.