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.
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.
Carcassonne
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Carcassonne
- Attachments
-
- MuckinAround.zip
- (2.52 KiB) Downloaded 384 times
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Carcassonne
I have just worked out how to set codes so one can identify the characteristics of the sides of a tile.
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.
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
- (2.42 KiB) Downloaded 358 times
Last edited by richmond62 on Tue Nov 24, 2015 7:15 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
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
customProperties for sides of cards have a look at the following image:
https://en.wikipedia.org/wiki/Carcasson ... rd_game%29