Page 1 of 1

### Carcassonne

Posted: Mon Nov 23, 2015 10:05 pm
I am playing around with tiling games, mainly as I use Carcassonne extensively as a teaching aid in my ESL school.

I have got to the, admittedly fairly primitive stage, of making a set of tiles, each capable of being dragged and dropped onto
a grid consisting of drop-targets made up of rectangular graphics.

Each of these tiles also "owns" a button in its centre that allows it to be rotated.
tileBtn.png (1.83 KiB) Viewed 1258 times
HOWEVER I have 2 main problems:

1. How do I make sure that once one of my tiles is 'occupying' a drop target no other tiles can be dropped on it?

2. How do I make sure that a tile can be dropped on a target ONLY when its sides match the sides of adjacent tiles?

I'm attaching my goofy stack here.

### Re: Carcassonne

Posted: Tue Nov 24, 2015 12:30 am
I have just worked out how to set codes so one can identify the characteristics of the sides of a tile.
customProps.png (9.77 KiB) Viewed 1233 times
When one clicks on the central button this rotates the tile and sets 4 customProperties of the image:

T,L,B,R {standing for 'top', 'left', 'right' and 'bottom' respectively]

This means that, regardless of the rotation of the image, one can always determine the colour of the side of the tile
and its location.

The button contains this code:

on mouseDown
put the B of img "t1" into fld "B"
put the L of img "t1" into fld "L"
put the R of img "t1" into fld "R"
put the T of img "t1" into fld "T"
end mouseDown

on mouseUp
put the B of img "t1" into RR
put the L of img "t1" into BB
put the R of img "t1" into TT
put the T of img "t1" into LL
set the angle of img "t1" to ((the angle of img "t1") + 90)
set the L of img "t1" to LL
set the R of img "t1" to RR
set the T of img "t1" to TT
set the B of img "t1" to BB
put the B of img "t1" into fld "B"
put the L of img "t1" into fld "L"
put the R of img "t1" into fld "R"
put the T of img "t1" into fld "T"
end mouseUp

The fields are, obviously, not required, they are here only for demonstration purposes.

### Re: Carcassonne

Posted: Tue Nov 24, 2015 12:43 am
Before anyone asks why I am messing around with this, and the thing about
customProperties for sides of cards have a look at the following image:
https://en.wikipedia.org/wiki/Carcasson ... rd_game%29