39
39
var tileWidth = 200 ,
40
40
tileHeight = 230 ;
41
41
42
- var mapScale = Math . min ( width / ( 7 * tileWidth ) , height / ( ( 17 / 3 ) * tileHeight ) ) ;
42
+ var mapScale = Math . min ( width / ( 7 * tileWidth ) , height / ( ( 19 / 3 ) * tileHeight ) ) ;
43
43
44
44
// create an empty container
45
45
var tileContainer = new PIXI . DisplayObjectContainer ( ) ;
46
46
47
47
// tiles are rotated so width correspond to height
48
- tileContainer . position . x = ( width / 2 ) - ( ( 7 * tileWidth * mapScale ) / 2 ) ;
49
- tileContainer . position . y = ( height / 2 ) - ( ( ( 16 / 3 ) * tileHeight * mapScale ) / 2 ) ;
48
+ tileContainer . position . x = ( width / 2 ) - ( ( ( 9 / 3 ) * tileWidth * mapScale ) / 2 ) ;
49
+ tileContainer . position . y = ( height / 2 ) - ( ( 8 * tileHeight * mapScale ) / 2 ) ;
50
+ tileContainer . pivot . x = 0.5 ;
51
+ tileContainer . pivot . y = 0.5 ;
52
+ tileContainer . rotation = Math . PI / 6 ;
50
53
tileContainer . scale . x = mapScale ;
51
54
tileContainer . scale . y = mapScale ;
52
55
var tiles = [ ] ;
72
75
tile . scale . y = 1 ;
73
76
tile . anchor . x = 0.5 ;
74
77
tile . anchor . y = 0.5 ;
75
- // turn left or right randomly
76
- tile . rotation = ( Catan . Tools . randInterval ( 0 , 1 ) * 2 - 1 ) * Math . PI / 6 ;
78
+ tile . rotation = - ( Catan . Tools . randInterval ( 0 , 6 ) * 2 + 1 ) * Math . PI / 6 ;
77
79
tiles . push ( tile ) ;
78
80
tileContainer . addChild ( tile ) ;
79
81
80
82
if ( hexagon . isLand ( ) && hexagon . hasNumber ( ) ) {
81
83
var token = new PIXI . Sprite ( textures . token ) ;
82
84
token . position . x = cx ;
83
85
token . position . y = cy ;
84
- token . scale . x = 0.8 ;
85
- token . scale . y = 0.8 ;
86
+ token . scale . x = 1.1 ;
87
+ token . scale . y = 1.1 ;
86
88
token . anchor . x = 0.5 ;
87
89
token . anchor . y = 0.5 ;
88
90
tileContainer . addChild ( token ) ;
89
91
90
- var textSize = Catan . Tools . tdsc ( hexagon . number ) * 5 + 15 ;
92
+ var textSize = Catan . Tools . tdsc ( hexagon . number ) * 5 + 45 ;
91
93
var textColor = Catan . Tools . tdsc ( hexagon . number ) >= 5 ? 'red' : 'black' ;
92
94
var text = new PIXI . Text ( hexagon . number , { font : textSize + "px Arial" , fill :textColor } ) ;
93
95
text . position . x = cx ;
94
96
text . position . y = cy ;
95
97
text . anchor . x = 0.5 ;
96
98
text . anchor . y = 0.5 ;
99
+ text . rotation = - Math . PI / 6 ;
97
100
tileContainer . addChild ( text ) ;
98
101
}
99
102
102
105
var harbor = new PIXI . Sprite ( textures [ hexagon . land ] ) ;
103
106
harbor . position . x = cx ;
104
107
harbor . position . y = cy ;
105
- harbor . scale . x = 0.3 ;
106
- harbor . scale . y = 0.3 ;
108
+ harbor . scale . x = 0.4 ;
109
+ harbor . scale . y = 0.4 ;
107
110
harbor . anchor . x = 0.5 ;
108
111
harbor . anchor . y = 0.5 ;
109
- // turn left or right randomly
110
- harbor . rotation = ( Catan . Tools . randInterval ( 0 , 1 ) * 2 - 1 ) * Math . PI / 6 ;
112
+ harbor . rotation = - ( Catan . Tools . randInterval ( 0 , 6 ) * 2 + 1 ) * Math . PI / 6 ;
111
113
tileContainer . addChild ( harbor ) ;
112
114
}
113
115
} ;
118
120
renderer . render ( stage ) ;
119
121
} ;
120
122
121
-
122
-
123
123
} ) ( Catan , PIXI ) ;
0 commit comments