1size 800 600
2background #f4f1ea
3
4// Carré réutilisable : un symbole paramétré (couleur + taille) remplace 6 chemins répétés.
5symbol "Carre"(col, s) {
6 layer "c" {
7 rect $(0 - s/2) $(0 - s/2) $(s) $(s) fill $(col)
8 }
9}
10
11var ax = 180
12var ay = 150
13var bx = 400
14var by = 130
15var cx = 620
16var cy = 170
17
18scene {
19 layer "Cibles" {
20 instance "Carre"("#1b1d2216", 110) as "CibleA" at 200,420 pivot 0,0
21 instance "Carre"("#1b1d2216", 110) as "CibleB" at 400,420 pivot 0,0
22 instance "Carre"("#1b1d2216", 110) as "CibleC" at 600,420 pivot 0,0
23 }
24 layer "Pieces" {
25 instance "Carre"("#ef5350", 90) as "PieceA" pivot 0,0
26 instance "Carre"("#42a5f5", 90) as "PieceB" pivot 0,0
27 instance "Carre"("#66bb6a", 90) as "PieceC" pivot 0,0
28 }
29}
30
31object "PieceA" {
32 drag ax, ay
33 when dropped on CibleA {
34 ax = CibleA.x
35 ay = CibleA.y
36 }
37 x = ax
38 y = ay
39}
40
41object "PieceB" {
42 drag bx, by
43 when dropped on CibleB {
44 bx = CibleB.x
45 by = CibleB.y
46 }
47 x = bx
48 y = by
49}
50
51object "PieceC" {
52 drag cx, cy
53 when dropped on CibleC {
54 cx = CibleC.x
55 cy = CibleC.y
56 }
57 x = cx
58 y = cy
59}