## Carcassonne

Creating Games? Developing something for fun?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

richmond62
Livecode Opensource Backer
Posts: 2792
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

### Carcassonne

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 1420 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.
Attachments
MuckinAround.zip

richmond62
Livecode Opensource Backer
Posts: 2792
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

### Re: Carcassonne

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 1395 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.
Attachments
Proppps.zip
Last edited by richmond62 on Tue Nov 24, 2015 7:15 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Posts: 2792
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

### Re: Carcassonne

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