Rexrainbow Board series tutorial #1 Board basic

6

Index

Attached Files

The following files have been attached to this tutorial:

.capx

Stats

11,075 visits, 24,156 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 24 Feb, 2016. Last updated 19 Feb, 2019

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:

Bind your [Board] to [HexTx].

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!

Click here to learn part 2

.CAPX
  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • I am not seeing the "stand on tile" parameter when I create the board. Where can I find this?