# Rexrainbow Board series tutorial #1 Board basic

4
• 25 favourites

### Attached Files

The following files have been attached to this tutorial:

.png

.png

.capx

### Stats

9,251 visits, 21,177 views

### Translations

• German

Chapter 5. More Powerful Plugins: <Chess> & <Gridmove>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hey, I know that you may feel that all what we've done is basically identical to make everything without <Board>. But please be patient because the most powerful function is coming up. And what you've done is just an basic infrastructure for your board game.

In this chapter we will utilize <Chess> and <Gridmove> to make the chess move fluently. You can even assign acceleration/deceleration for the movement. Beside that, you might found a bug in previous work that our chess will be missing if player move it out of the board. Now everything will be perfect after we include those two new plugins. Check it out.

New function1: Smooth movement done by <Gridmove>

Go back to <Layout 1>, add a <Gridmove> behavior for [chess].

When you've done, go to <Event sheet 1> and update Event11~14:

The action we used for this update is [chess]-><Gridmove>-><Move to neighbor>--- but please be cautious! There are 4 actions called <Move to neighbor>, and what we want is located uder Square grid category.

When you've done, push <F4> to run layout. You'll find your problems are all solved! Your chess moves fluently, and it can't go outside the board anymore.

You can try to assign the acceleration/deceleration parameter for <Gridmove> and feel the changes it makes.

New function2: Read chess logical position by <Chess> behavior

In the previous design we get the logical position of the chess by PXY2LX()/PXY2LY expressions of <Board>, it is a little bit lousy. Next we will use <Chess> behavior to have a quicker solution to read logical information of a chess, or pick a chess in a more intuitive way.

Add a <Chess> behavior for [chess] object.

Go to <Event sheet 1> and rewrite your codes:

Event9 is rewrite by [chess]-><Chess>-><Compare LX>/<Compare LY> events. These two conditions filter out the chess with current loop indexes. Event11 is introduced with [chess]-><Chess>-><Move chess to xyz> action, which has more readability than before. Push <F4> to run layout, function works like before.

Chapter 6. Minimum efforts with awesome functions

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In this chapter, we left some surprises as a bonus for readers who overcome all the difficulties and reach this chapter. Just be chill, everything in this chapter is cool but very easy to realize (because you use <Board>!).

Bonus1: Wrap the board

We all know that C2 has a <Wrap> behavior which enables objects to be wrapped in layout. If you want any chess to have similar function in a board, just enable the <wrap> parameter to <Yes>. Then when you move your chess with <Gridmove>, your chess will be wrapped in your board.

Bonus2: Make a HEX board

HEX board is difficult to realize if you ever try to make a HEX game without <Board> plugin. But now since we've used <Board>, making HEX board is just a piece of cake:

Add <HexTx> plugin to your project and set its properties like below:

Rewrite your <Gridmove> actions. This time please uses <Request: Hexagon grid (Left-Right)> category.

Congratulations, Now your HEX board is completed!

Hope you'll like this tutorial, see you next time!

.PNG

.PNG