File tree Expand file tree Collapse file tree 6 files changed +281
-134
lines changed
Expand file tree Collapse file tree 6 files changed +281
-134
lines changed Original file line number Diff line number Diff line change @@ -246,12 +246,14 @@ Sprite* Sprite::create(Properties* properties)
246246 float heightPercentage = 0 .0f ;
247247 if (properties->exists (" width" ))
248248 {
249- if (properties->getType (" width" ) == Properties::NUMBER) // TODO: Verify that this works for "100" but fails for "100%"
249+ if (properties->getType (" width" ) == Properties::NUMBER)
250250 {
251+ // Number only (200)
251252 width = properties->getFloat (" width" );
252253 }
253254 else
254255 {
256+ // Number and something else (200%)
255257 widthPercentage = properties->getFloat (" width" ) / 100 .0f ;
256258 }
257259 }
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ TileSet* TileSet::create(Properties* properties)
136136 Vector2 cell;
137137 Vector2 source;
138138 if (tileProperties->getVector2 (" cell" , &cell) && tileProperties->getVector2 (" source" , &source) &&
139- (cell.x > 0 && cell.y > 0 && cell.x < set->_columnCount && cell.y < set->_rowCount ))
139+ (cell.x >= 0 && cell.y >= 0 && cell.x < set->_columnCount && cell.y < set->_rowCount ))
140140 {
141141 set->_tiles [(int )cell.y * set->_columnCount + (int )cell.x ] = source;
142142 }
Original file line number Diff line number Diff line change 1+ scene spriteSampleScene
2+ {
3+ // Width and height are expected to be 1280x720
4+
5+ node camera
6+ {
7+ camera
8+ {
9+ type = ORTHOGRAPHIC
10+ nearPlane = 0
11+ farPlane = 100
12+
13+ // zoomX default is game width
14+ // zoomY default is game height
15+ // aspectRatio default is game width / game height
16+ }
17+
18+ // width and height are divided in half
19+ translate = 640, 360, 0
20+ }
21+
22+ // Background sprite
23+ node background
24+ {
25+ sprite
26+ {
27+ path = res/common/sprites/background.png
28+
29+ // game width * 5
30+ width = 6400
31+ height = 720
32+ }
33+ }
34+
35+ // Level floor
36+ node floor
37+ {
38+ tileset
39+ {
40+ path = res/common/sprites/level.png
41+
42+ tileWidth = 70
43+ tileHeight = 70
44+
45+ rows = 3
46+ columns = 7
47+
48+ tile
49+ {
50+ cell = 0, 0
51+ source = 568, 284
52+ }
53+ tile
54+ {
55+ cell = 1, 0
56+ source = 568, 284
57+ }
58+ tile
59+ {
60+ cell = 2, 0
61+ source = 568, 284
62+ }
63+ tile
64+ {
65+ cell = 3, 0
66+ source = 568, 284
67+ }
68+ tile
69+ {
70+ cell = 4, 0
71+ source = 497, 284
72+ }
73+
74+ tile
75+ {
76+ cell = 0, 1
77+ source = 568, 0
78+ }
79+ tile
80+ {
81+ cell = 1, 1
82+ source = 568, 0
83+ }
84+ tile
85+ {
86+ cell = 2, 1
87+ source = 568, 0
88+ }
89+ tile
90+ {
91+ cell = 3, 1
92+ source = 568, 0
93+ }
94+ tile
95+ {
96+ cell = 4, 1
97+ source = 710, 142
98+ }
99+ tile
100+ {
101+ cell = 5, 1
102+ source = 497, 284
103+ }
104+
105+ tile
106+ {
107+ cell = 0, 2
108+ source = 568, 0
109+ }
110+ tile
111+ {
112+ cell = 1, 2
113+ source = 568, 0
114+ }
115+ tile
116+ {
117+ cell = 2, 2
118+ source = 568, 0
119+ }
120+ tile
121+ {
122+ cell = 3, 2
123+ source = 568, 0
124+ }
125+ tile
126+ {
127+ cell = 4, 2
128+ source = 568, 0
129+ }
130+ tile
131+ {
132+ cell = 5, 2
133+ source = 710, 142
134+ }
135+ tile
136+ {
137+ cell = 6, 2
138+ source = 497, 284
139+ }
140+ }
141+ }
142+
143+ node player
144+ {
145+ sprite
146+ {
147+ path = res/common/sprites/player1.png
148+
149+ width = 72
150+ height = 97
151+
152+ source = 67, 196, 66, 92
153+ frameCount = 13
154+ }
155+
156+ // Position player at lower-left. Y position is floor's tileset height (tileHeight * rows)
157+ translate = 0, 210, 0
158+ }
159+
160+ node rocket
161+ {
162+ sprite
163+ {
164+ path = res/common/sprites/rocket.png
165+
166+ width = 128
167+ height = 128
168+
169+ blendMode = BLEND_ADDITIVE
170+ anchor = 0.5, 0.3
171+ offset = OFFSET_ANCHOR
172+ }
173+
174+ translate = 1280, 0, 0
175+ rotate = 0, 0, 1, -45
176+ }
177+
178+ node water
179+ {
180+ // Sprite drawable set in code because Effect isn't supported
181+
182+ translate = 0, -50, 0
183+ }
184+
185+ node text
186+ {
187+ text
188+ {
189+ font = res/ui/arial.gpb
190+
191+ text = P1
192+ size = 18
193+ color = 0, 0, 1, 1
194+ }
195+ }
196+
197+ // Set active camera
198+ activeCamera = camera
199+ }
Original file line number Diff line number Diff line change 345345 <ClInclude Include =" src\WaterSample.h" >
346346 <Filter >src</Filter >
347347 </ClInclude >
348- <ClInclude Include =" src\ParticlesSample.h" />
349- <ClInclude Include =" src\FontSample.h" />
350- <ClInclude Include =" src\SpriteSample.h" />
351348 <ClInclude Include =" src\SceneCreateSample.h" >
352349 <Filter >src</Filter >
353350 </ClInclude >
357354 <ClInclude Include =" src\AudioSample.h" >
358355 <Filter >src</Filter >
359356 </ClInclude >
357+ <ClInclude Include =" src\FontSample.h" >
358+ <Filter >src</Filter >
359+ </ClInclude >
360+ <ClInclude Include =" src\ParticlesSample.h" >
361+ <Filter >src</Filter >
362+ </ClInclude >
363+ <ClInclude Include =" src\SpriteSample.h" >
364+ <Filter >src</Filter >
365+ </ClInclude >
360366 </ItemGroup >
361367 <ItemGroup >
362368 <ClCompile Include =" src\MeshPrimitiveSample.cpp" >
419425 <ClCompile Include =" src\WaterSample.cpp" >
420426 <Filter >src</Filter >
421427 </ClCompile >
422- <ClCompile Include =" src\ParticlesSample.cpp" />
423- <ClCompile Include =" src\FontSample.cpp" />
424- <ClCompile Include =" src\SpriteSample.cpp" />
425428 <ClCompile Include =" src\SceneCreateSample.cpp" >
426429 <Filter >src</Filter >
427430 </ClCompile >
431434 <ClCompile Include =" src\AudioSample.cpp" >
432435 <Filter >src</Filter >
433436 </ClCompile >
437+ <ClCompile Include =" src\FontSample.cpp" >
438+ <Filter >src</Filter >
439+ </ClCompile >
440+ <ClCompile Include =" src\ParticlesSample.cpp" >
441+ <Filter >src</Filter >
442+ </ClCompile >
443+ <ClCompile Include =" src\SpriteSample.cpp" >
444+ <Filter >src</Filter >
445+ </ClCompile >
434446 </ItemGroup >
435447 <ItemGroup >
436448 <Image Include =" res\common\terrain\dirt.dds" >
You can’t perform that action at this time.
0 commit comments