An automated turn tracker

5 views
Skip to first unread message

Eggy

unread,
May 22, 2011, 7:26:49 PM5/22/11
to ever...@googlegroups.com
Hey EveryGame users,

Recently someone emailed us about creating an automated turn tracker for a game like Chess, that displays which player's turn it is, and automatically flips over each time they move a piece.

I did up a simple little example using location_in_action tags to increment the side of a tracker (along with a normal single_tap action to account for players needing to move two pieces in a row while castling).

For anyone else interested, I'll post the xml code for the checkers game below. To try it on your device, just copy the xml code into a Checkers_game.xml file, and use iTunes to copy it onto your device. Or just use it as reference -- everything added for the turn tracker is denoted by comments.

-Nathaniel


<game xml_version="1.0">

<sides paths="Checkers_board.gif">
<board>Main board</board>
</sides>


<!-- THIS LINE ADDED FOR ACTIVE PLAYER TRACKING -->
<location_in_action action="increment_side" args="wrap,activePlayer">

<size width="90" height="90">
<location_type type="cell">

<corner_coord board="0" x="24" y="114">
<location>1b</location>
</corner_coord>

<corner_coord board="0" x="24" y="294">
<location>1d</location>
</corner_coord>

<corner_coord board="0" x="24" y="474">
<location>1f</location>
</corner_coord>

<corner_coord board="0" x="24" y="654">
<location>1h</location>
</corner_coord>

<corner_coord board="0" x="114" y="24">
<location>2a</location>
</corner_coord>

<corner_coord board="0" x="114" y="204">
<location>2c</location>
</corner_coord>

<corner_coord board="0" x="114" y="384">
<location>2e</location>
</corner_coord>

<corner_coord board="0" x="114" y="564">
<location>2g</location>
</corner_coord>

<corner_coord board="0" x="204" y="114">
<location>3b</location>
</corner_coord>

<corner_coord board="0" x="204" y="294">
<location>3d</location>
</corner_coord>

<corner_coord board="0" x="204" y="474">
<location>3f</location>
</corner_coord>

<corner_coord board="0" x="204" y="654">
<location>3h</location>
</corner_coord>

<corner_coord board="0" x="294" y="24">
<location>4a</location>
</corner_coord>

<corner_coord board="0" x="294" y="204">
<location>4c</location>
</corner_coord>

<corner_coord board="0" x="294" y="384">
<location>4e</location>
</corner_coord>

<corner_coord board="0" x="294" y="564">
<location>4g</location>
</corner_coord>

<corner_coord board="0" x="384" y="114">
<location>5b</location>
</corner_coord>

<corner_coord board="0" x="384" y="294">
<location>5d</location>
</corner_coord>

<corner_coord board="0" x="384" y="474">
<location>5f</location>
</corner_coord>

<corner_coord board="0" x="384" y="654">
<location>5h</location>
</corner_coord>

<corner_coord board="0" x="474" y="24">
<location>6a</location>
</corner_coord>

<corner_coord board="0" x="474" y="204">
<location>6c</location>
</corner_coord>

<corner_coord board="0" x="474" y="384">
<location>6e</location>
</corner_coord>

<corner_coord board="0" x="474" y="564">
<location>6g</location>
</corner_coord>

<corner_coord board="0" x="564" y="114">
<location>7b</location>
</corner_coord>

<corner_coord board="0" x="564" y="294">
<location>7d</location>
</corner_coord>

<corner_coord board="0" x="564" y="474">
<location>7f</location>
</corner_coord>

<corner_coord board="0" x="564" y="654">
<location>7h</location>
</corner_coord>

<corner_coord board="0" x="654" y="24">
<location>8a</location>
</corner_coord>

<corner_coord board="0" x="654" y="204">
<location>8c</location>
</corner_coord>

<corner_coord board="0" x="654" y="384">
<location>8e</location>
</corner_coord>

<corner_coord board="0" x="654" y="564">
<location>8g</location>
</corner_coord>

</location_type>
</size>


<!-- THIS LINE ADDED FOR ACTIVE PLAYER TRACKING -->
</location_in_action>


<size width="270" height="270">

<location_type type="stack">
<corner_coord board="0" x="750" y="24">
<location>red_capture</location>
</corner_coord>
<corner_coord board="0" x="750" y="474">
<location>black_capture</location>
</corner_coord>
</location_type>
</size>

<!-- THIS BLOCK ADDED FOR ACTIVE PLAYER TRACKING -->
<size width="200" height="200">
<corner_coord board="0" x="750" y="294">
<location>active</location>
</corner_coord>
</size>

<!-- THIS BLOCK ADDED FOR ACTIVE PLAYER TRACKING -->
<initial_location name="active">
<sides paths="Checkers_red.gif,Checkers_black.gif">
<single_tap action="increment_side" args="wrap">
<piece>activePlayer</piece>
</single_tap>
</sides>
</initial_location>


<double_tap action="increment_side" args="wrap">
<single_tap action="move_piece" args="red_capture">



<sides paths="Checkers_red.gif,Checkers_redking.gif">
<initial_location name="2a">
<piece>r0</piece>
</initial_location>
<initial_location name="4a">
<piece>r1</piece>
</initial_location>
<initial_location name="6a">
<piece>r2</piece>
</initial_location>
<initial_location name="8a">
<piece>r3</piece>
</initial_location>
<initial_location name="1b">
<piece>r4</piece>
</initial_location>
<initial_location name="3b">
<piece>r5</piece>
</initial_location>
<initial_location name="5b">
<piece>r6</piece>
</initial_location>
<initial_location name="7b">
<piece>r7</piece>
</initial_location>
<initial_location name="2c">
<piece>r8</piece>
</initial_location>
<initial_location name="4c">
<piece>r9</piece>
</initial_location>
<initial_location name="6c">
<piece>r10</piece>
</initial_location>
<initial_location name="8c">
<piece>r11</piece>
</initial_location>

</sides>

</single_tap>
<single_tap action="move_piece" args="black_capture">


<sides paths="Checkers_black.gif,Checkers_blackking.gif">
<initial_location name="1f">
<piece>b0</piece>
</initial_location>
<initial_location name="3f">
<piece>b1</piece>
</initial_location>
<initial_location name="5f">
<piece>b2</piece>
</initial_location>
<initial_location name="7f">
<piece>b3</piece>
</initial_location>
<initial_location name="2g">
<piece>b4</piece>
</initial_location>
<initial_location name="4g">
<piece>b5</piece>
</initial_location>
<initial_location name="6g">
<piece>b6</piece>
</initial_location>
<initial_location name="8g">
<piece>b7</piece>
</initial_location>
<initial_location name="1h">
<piece>b8</piece>
</initial_location>
<initial_location name="3h">
<piece>b9</piece>
</initial_location>
<initial_location name="5h">
<piece>b10</piece>
</initial_location>
<initial_location name="7h">
<piece>b11</piece>
</initial_location>
</sides>


</single_tap>
</double_tap>

</game>

Rob3d

unread,
May 22, 2011, 8:00:22 PM5/22/11
to ever...@googlegroups.com
Thanks for this I was thinking of implementing something similar for my monopoly deal module.
Reply all
Reply to author
Forward
0 new messages