3
votes

So lets say i'm making a board game. i've got a game board array, my logic needs to check for position and collision detection, thats all fine.

Traditionally using something like directX you would have a game loop, test some logic, update the game board array and finally draw the screen, but with cocos2dx we don't directly draw to the screen we add sprite to layers, and cocos does the rest!

For instance..

  • Initialise a game array that represents the game board
  • Initialise a game object
  • add objects to the array
  • update the screen (render the array to the screen)
  • start game loop
  • Test for some logic condition
  • remove object from array
  • more Test for some logic condition, update object position
  • add objects to the array
  • update the screen again
  • loop

The previous would work fine but i don't need to remove the object from the layer only to update its position and re-render to the screen, with cocos2d/cocos2dx if i keep a reference to that object i could just move it, and update the array.

I can continue with this approach, but i want to know if i'm missing something.

The game array helps with the game logic and mimics the actual playable area, but i can't help feeling its a bit stone-age.

Can anybody help with this, am i completely missing the plot?

2

2 Answers

3
votes

All game engines use an update loop. Without it, you wouldn't be rendering anything.

That said, if your game is entirely user-input driven, you can react to user input events (touches) and only then perform game logic (moving or removing pieces, checking win conditions, update score, next turn).

If you want "new-school" then you'll be looking at a game design tool, not a game engine.

1
votes

This looks fine to me. The thing to keep in mind is during your game loop you will be able to handle animations that keep the board game interesting. I think that is not overkill, you can always find things to animate.