├── .gitattributes ├── .gitignore ├── README.md ├── assets ├── .DS_Store ├── bricks.atlas ├── colorboys.afphoto ├── colorboys_face.afphoto ├── fonts │ ├── .DS_Store │ ├── open_sans │ │ ├── LICENSE.txt │ │ └── OpenSans-Regular.ttf │ └── passion_one │ │ ├── OFL.txt │ │ └── PassionOne-Regular.ttf ├── headings.font ├── images │ ├── .DS_Store │ ├── blue.png │ ├── button.png │ ├── eyeball_angry_left.png │ ├── eyeball_angry_right.png │ ├── eyeball_happy_left.png │ ├── eyeball_happy_right.png │ ├── green.png │ ├── grey.png │ ├── left_angry.png │ ├── left_angry_blink.png │ ├── left_happy.png │ ├── left_happy_blink.png │ ├── logo.png │ ├── mouth_angry_closed.png │ ├── mouth_angry_open.png │ ├── mouth_happy_closed.png │ ├── mouth_happy_open.png │ ├── red.png │ ├── right_angry.png │ ├── right_angry_blink.png │ ├── right_happy.png │ ├── right_happy_blink.png │ ├── tiles.png │ └── yellow.png └── level.tilesource ├── doc ├── .DS_Store ├── level_gui.png ├── level_gui@2x.png ├── level_select.png ├── level_select@2x.png ├── level_select_back.png ├── level_select_back@2x.png ├── level_select_script.png ├── level_select_script@2x.png ├── main_collection.png ├── main_collection@2x.png ├── main_proxies.png ├── main_proxies@2x.png ├── main_proxy.png ├── main_proxy@2x.png ├── socket_name.png ├── socket_name@2x.png ├── start_gui.png └── start_gui@2x.png ├── game.project ├── input └── game.input_binding └── main ├── brick ├── brick.collection ├── brick.go ├── brick.script └── face.script ├── colors.lua ├── level.go ├── level.script ├── level_1 ├── level_1.collection └── level_1.tilemap ├── level_2 ├── level_2.collection └── level_2.tilemap ├── level_3 ├── level_3.collection └── level_3.tilemap ├── level_4 ├── level_4.collection └── level_4.tilemap └── main.collection /.gitattributes: -------------------------------------------------------------------------------- 1 | *.dae binary 2 | 3 | # Defold Protocol Buffer Text Files (https://github.com/github/linguist/issues/5091) 4 | *.animationset linguist-language=JSON5 5 | *.atlas linguist-language=JSON5 6 | *.camera linguist-language=JSON5 7 | *.collection linguist-language=JSON5 8 | *.collectionfactory linguist-language=JSON5 9 | *.collectionproxy linguist-language=JSON5 10 | *.collisionobject linguist-language=JSON5 11 | *.cubemap linguist-language=JSON5 12 | *.display_profiles linguist-language=JSON5 13 | *.factory linguist-language=JSON5 14 | *.font linguist-language=JSON5 15 | *.gamepads linguist-language=JSON5 16 | *.go linguist-language=JSON5 17 | *.gui linguist-language=JSON5 18 | *.input_binding linguist-language=JSON5 19 | *.label linguist-language=JSON5 20 | *.material linguist-language=JSON5 21 | *.mesh linguist-language=JSON5 22 | *.model linguist-language=JSON5 23 | *.particlefx linguist-language=JSON5 24 | *.render linguist-language=JSON5 25 | *.sound linguist-language=JSON5 26 | *.sprite linguist-language=JSON5 27 | *.spinemodel linguist-language=JSON5 28 | *.spinescene linguist-language=JSON5 29 | *.texture_profiles linguist-language=JSON5 30 | *.tilemap linguist-language=JSON5 31 | *.tilesource linguist-language=JSON5 32 | 33 | # Defold JSON Files 34 | *.buffer linguist-language=JSON 35 | 36 | # Defold GLSL Shaders 37 | *.fp linguist-language=GLSL 38 | *.vp linguist-language=GLSL 39 | 40 | # Defold Lua Files 41 | *.editor_script linguist-language=Lua 42 | *.render_script linguist-language=Lua 43 | *.script linguist-language=Lua 44 | *.gui_script linguist-language=Lua 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.editor_settings 2 | /.internal 3 | /build 4 | .externalToolBuilders 5 | .DS_Store 6 | Thumbs.db 7 | .lock-wscript 8 | *.pyc 9 | .project 10 | .cproject 11 | builtins -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Colorslide tutorial 2 | 3 | Welcome to the Colorslide game tutorial. It will take you through the process of adding a simple GUI flow to an existing multi level mobile game. It is assumed that you know your way around the editor. If you don't, please check out [our manuals and beginner tutorials](https://www.defold.com/learn). 4 | 5 | The starting point for this tutorial is this project. It contains everything you need: 6 | 7 | - A simple but fully playable game where the player slides colored bricks on a tiled board until every brick's color matches the tile they sit on. 8 | - 4 example levels are included. They are of various difficulty. Each level is built in its own collection. 9 | - Assets are included so you can build any number of levels, using the built in tile editor. 10 | 11 | After having finished the tutorial, you will have accomplished the following: 12 | 13 | - You have added a level selection screen from where the player can start any of the 4 levels. 14 | - You have added a level completion message allowing the player to continue to the next level. 15 | - You have added a start screen. 16 | - You have added buttons so the user can navigate between these screens. 17 | 18 | ## Understanding the game setup 19 | 20 | Before beginning the tutorial, [try running the game](defold://build), then open ["main.collection"](defold://open?path=/main/main.collection) to see how the game is set up. 21 | 22 | 23 | 24 | The whole game is contained in a subcollection called "level" inside "main.collection". Currently, "level" references the file "/main/level_2/level_2.collection". Opening the "level" collection file reveals two game objects: 25 | 26 | 1. One game object with id "board". This one contains the tilemap. Notice that there are two layers on the tilemap, one is the actual playfield (with layer id "board") and one contains the intitial setup for the bricks (with layer id "setup"). When the game starts, it looks at the setup layer and replaces the brick tiles with separate game objects that can be animated freely. It then clears the layer. 27 | 28 | 2. One game object with id "level". This one contains the game logic script ("level.script") and a factory used to spawn bricks on game start. This game object is stored in a separate file called "/main/level.go" so game objects of this blueprint file can be instantiated in each separate level collection. 29 | 30 | Now try some of the other levels: 31 | 32 | Open "main.collection". 33 | 34 | Mark "level" change its reference in the *Path* property to "/main/level_3/level_3.collection". 35 | 36 | Build and run the game again (Project ▸ Build). Do the same for levels 1 and 4. 37 | 38 | ## Loading collections via proxy 39 | 40 | What is needed for this game is a way to make the level loading automatic and depending on player choice. Defold contains two mechanisms for loading collections dynamically: 41 | 42 | 1. Collection factories. This is a good choice for spawning hierarchies of objects into a running game, like enemy units, effects or interactive objects. Any spawned object will be part of the startup main collection world and live until the game shuts down, unless you explicitly delete the objects yourself. 43 | 44 | 2. Collection proxies. This is a good choice when you want to load larger chunks of a game dynamically, for instance a game level. With a proxy you create a new "world" based on the collection. Any object that is spawned from the collection content will be part of the created world and be automatically destroyed when the collection is unloaded from the proxy. The new world that is created has an overhead cost attached to it so proxies are not a good fit for spawning large quantities of small collections simultaneously. 45 | 46 | For this game, proxies will be the best choice. 47 | 48 | Open "main.collection" and remove the "level" collection reference. Instead, add a new game object and give it id "loader". 49 | 50 | Add a collection proxy component to the game object, name it "proxy_level_1" and set its *Collection* property to "/main/level_1/level_1.collection". 51 | 52 | Add a new script file called "loader.script" and add it as a script component to the "loader" game object. 53 | 54 | NOTE: The Defold editor will automatically add `.script` to the filename you provide. Make sure to only type in `loader` as name in the New Script popup. 55 | 56 | 57 | 58 | Open "loader.script" and change its content to the following: 59 | 60 | ```lua 61 | function init(self) 62 | msg.post("#proxy_level_1", "load") -- [1] 63 | end 64 | 65 | function on_message(self, message_id, message, sender) 66 | if message_id == hash("proxy_loaded") then -- [2] 67 | msg.post(sender, "init") 68 | msg.post(sender, "enable") 69 | end 70 | end 71 | ``` 72 | 1. Send a message to the proxy component telling it to start loading its collection. 73 | 2. When the proxy component is done loading, it sends a "proxy_loaded" message back. You can then send "init" and "enable" messages to the collection to initialize and enable the collection content. We can send these messages back to "sender" which is the proxy component. 74 | 75 | Now try to run the game. 76 | 77 | Unfortunately there is an instant error. The console says: 78 | 79 | ``` 80 | ERROR:GAMEOBJECT: The collection 'default' could not be created since there is already a socket with the same name. 81 | ERROR:GAMEOBJECT: AcquireResources NewCollection RESULT_OUT_OF_RESOURCES 82 | WARNING:RESOURCE: Unable to create resource: /main/level_1/level_1.collectionc: OUT_OF_RESOURCES 83 | ERROR:GAMESYS: The collection /main/level_1/level_1.collectionc could not be loaded. 84 | ``` 85 | 86 | This error occurs because the proxy tries to create a new world (socket) with the name "default". But a world with that name already exists - the one created from "main.collection" at engine boot. The socket name is set in the properties of the collection root so it's very easy to fix: 87 | 88 | Open the file "/main/level_1/level_1.collection", mark the root of the collection and set the *Name* property to "level_1". And, mark the level.go and set the *Id* property to "level_1". Save the file. 89 | 90 | 91 | 92 | Try running the game again. 93 | 94 | The level now shows up, but if you try to click on the board to move a tile, nothing happens. Why is that? 95 | 96 | The problem is that the script that deals with input is now inside the proxied world. The input system works like this: 97 | 98 | * It sends input to all game objects in the bootstrap collection that has acquired input focus. 99 | * If one of these objects listening to input contains a proxy, input is directed to any object in the game world behind the proxy that has acquired input focus. 100 | 101 | So in order to get input into the proxied collection, the game object that contains the proxy component must listen to input. 102 | 103 | Open "loader.script" and add a line to the `init()` function: 104 | 105 | ``` 106 | function init(self) 107 | msg.post("#proxy_level_1", "load") 108 | msg.post(".", "acquire_input_focus") -- [1] 109 | end 110 | ``` 111 | 1. Since this game object holds the proxy for the collection that needs input, this game object needs to acquire input focus too. 112 | 113 | Run the game again. Now everything should work as expected. 114 | 115 | Because the game contains four levels you need to add proxy components for the remaining three levels. Don't forget to change the *Id* property to a unique name for each level collection so the socket names don't collide when a proxy loads. 116 | 117 | 118 | 119 | Test that each level loads by altering the proxy component you send the "load" message: 120 | 121 | * `msg.post("#proxy_level_1", "load")` 122 | * `msg.post("#proxy_level_2", "load")` 123 | * `msg.post("#proxy_level_3", "load")` 124 | * `msg.post("#proxy_level_4", "load")` 125 | 126 | ## The level selection screen 127 | 128 | Now you have built the setup required to load any level at any moment so it is time to construct an interface to the level loading. 129 | 130 | Create a new GUI file and call it "level_select.gui". 131 | 132 | Add the "headings" font to the *Font* section of the GUI (right click the *Fonts* item in the outline and select Add ▸ Fonts...). 133 | 134 | Add the "bricks" atlas to the *Textures* section of the GUI (right click the *Textures* item in the outline and select Add ▸ Textures...). 135 | 136 | Construct an interface with 4 buttons, one for each level. For each button: 137 | 138 | 1. Create one root Box node (right click *Nodes* and select Add ▸ Box). 139 | 2. Set the *Id* to "level_1". 140 | 3. Set the *Size Mode* to `Manual` and the *Size* to 100, 100, 0. 141 | 4. Set the *Alpha* to `0` so the node will be invisible. 142 | 5. Create a child Box node to "level_1" (right click "level_1" and select Add ▸ Box). 143 | 6. Set the *Id* of the child node to "1_bg". 144 | 7. Set the *Texture* of the node to `bricks/button`. 145 | 8. Uncheck *Inherit Alpha* on the node so it renders even if its parent is transparent. 146 | 9. Create a child Text node to "level_1" (right click "level_1" and select Add ▸ Text). 147 | 10. Set the *Id* of the child node to "1_text". 148 | 11. Set the *Text* of the node to "1". 149 | 12. Set the *Font* of the node to `headings`. 150 | 13. Uncheck *Inherit Alpha* on the node so it renders even if its parent is transparent. 151 | 152 | If you change the size of your graphics make sure that each root node is big enough to cover the whole button graphics because the root node will be used to test input against. 153 | 154 | Repeat the above steps for all 4 level buttons and move each root node into position. Also add a text node header: 155 | 156 | 1. Create one Text node (right click *Nodes* and select Add ▸ Text). 157 | 2. Set the *Id* to "select_header". 158 | 3. Set the *Font* to "headings". 159 | 4. Set the *Text* to "SELECT LEVEL". 160 | 161 | 162 | 163 | Create a new GUI script file and call it "level_select.gui_script". 164 | 165 | Open "level_select.gui_script" and change the script to the following: 166 | 167 | ```lua 168 | function init(self) 169 | msg.post(".", "acquire_input_focus") 170 | msg.post("#", "show_level_select") -- [1] 171 | self.active = false 172 | end 173 | 174 | function on_message(self, message_id, message, sender) 175 | if message_id == hash("show_level_select") then -- [2] 176 | msg.post("#", "enable") 177 | self.active = true 178 | elseif message_id == hash("hide_level_select") then -- [3] 179 | msg.post("#", "disable") 180 | self.active = false 181 | end 182 | end 183 | 184 | function on_input(self, action_id, action) 185 | if action_id == hash("touch") and action.pressed and self.active then 186 | for n = 1,4 do -- [4] 187 | local node = gui.get_node("level_" .. n) 188 | if gui.pick_node(node, action.x, action.y) then -- [5] 189 | msg.post("/loader#loader", "load_level", { level = n }) -- [6] 190 | msg.post("#", "hide_level_select") -- [7] 191 | end 192 | end 193 | end 194 | end 195 | ``` 196 | 1. Set up the GUI. 197 | 2. Showing and hiding the GUI is triggered via messaging so it can be done from other scripts. 198 | 3. React to the pressing of touch input (as already set up in the [input bindings](defold://open?path=/input/game.input_binding)). 199 | 4. The button nodes are named "level_1" to "level_4" so they can be looped over. 200 | 5. Check if the touch action happens within the boundaries of node "level_n". This means that the click happened on the button. 201 | 6. Send a message to the loader script to load level `n`. Notice that a "load" message is not sent directly to the proxy from here since this script does not deal with the rest of the proxy loading logic, as a reaction to "proxy_loaded". 202 | 7. Hide this GUI. 203 | 204 | Open "level_select.gui" and set the *Script* property on the root node to the new script. 205 | 206 | 207 | 208 | To finish off this step, the loader script needs a bit of new code to react to the "load_level" message, and the proxy loading on init should be removed. 209 | 210 | Open "loader.script" and change the `init()` and `on_message()` functions: 211 | 212 | ```lua 213 | function init(self) 214 | msg.post(".", "acquire_input_focus") 215 | end 216 | 217 | function on_message(self, message_id, message, sender) 218 | if message_id == hash("load_level") then 219 | local proxy = "#proxy_level_" .. message.level -- [1] 220 | msg.post(proxy, "load") 221 | elseif message_id == hash("proxy_loaded") then 222 | msg.post(sender, "init") 223 | msg.post(sender, "enable") 224 | end 225 | end 226 | ``` 227 | 1. Construct which proxy to load based on message data. 228 | 229 | Open "main.collection" and add a new game object with id "guis". 230 | 231 | Add "level_select.gui" as a GUI component to the new "guis" game object. 232 | 233 | Run the game and test the level selector screen. You should be able to click any of the level buttons and the corresponding level will load and be playable. 234 | 235 | ## In game GUI 236 | 237 | You can now start and play a level but there is no way to go back. The next step is to add an in game GUI that allows you to navigate back to the level selection screen. It should also congratulate the player when the level is completed and allow moving directly to the next level: 238 | 239 | Create a new GUI file and call it "level.gui". 240 | 241 | Add "headings" to the *Font* section and the "bricks" atlas to the *Textures* section of the GUI. 242 | 243 | Build one back-button at the top and one level number indicator at the top. 244 | 245 | Build a level complete message with a "well done" message and a "next"-button. Child these to a panel (a colored box node), call it "done" and place it outside of the view so they can be slide into view when the level is completed: 246 | 247 | 248 | 249 | Create a new GUI script file and call it "level.gui_script". 250 | 251 | Open "level.gui_script" and change the script to the following: 252 | 253 | ```lua 254 | function on_message(self, message_id, message, sender) 255 | if message_id == hash("level_completed") then -- [1] 256 | local done = gui.get_node("done") 257 | gui.animate(done, "position.x", 320, gui.EASING_OUTSINE, 1, 1.5) 258 | end 259 | end 260 | 261 | function on_input(self, action_id, action) -- [2] 262 | if action_id == hash("touch") and action.pressed then 263 | local back = gui.get_node("back") 264 | if gui.pick_node(back, action.x, action.y) then 265 | msg.post("default:/guis#level_select", "show_level_select") -- [3] 266 | msg.post("default:/loader#loader", "unload_level") 267 | end 268 | 269 | local next = gui.get_node("next") 270 | if gui.pick_node(next, action.x, action.y) then 271 | msg.post("default:/loader#loader", "next_level") -- [4] 272 | end 273 | end 274 | end 275 | ``` 276 | 1. If message "level_complete" is received, slide the "done" panel with the "next" button into view. 277 | 2. This GUI will be put on the "level" game object which already acquires input focus (through "level.script") so this script should not do that. 278 | 3. If the player presses "back", tell the level selector to show itself and the loader to unload the level. Note that the socket name of the bootstrap collection is used in the address. 279 | 4. If the player presses "next", tell the loader to load the next level. 280 | 281 | Open "level.gui" and set the *Script* property on the root node to the new script. 282 | 283 | Open "loader.script" and change it to the following: 284 | 285 | ```lua 286 | function init(self) 287 | msg.post(".", "acquire_input_focus") 288 | self.current_level = 0 -- [1] 289 | end 290 | 291 | function on_message(self, message_id, message, sender) 292 | if message_id == hash("load_level") then 293 | self.current_level = message.level 294 | local proxy = "#proxy_level_" .. self.current_level 295 | msg.post(proxy, "load") 296 | elseif message_id == hash("next_level") then -- [2] 297 | msg.post("#", "unload_level") 298 | msg.post("#", "load_level", { level = self.current_level + 1 }) 299 | elseif message_id == hash("unload_level") then -- [3] 300 | local proxy = "#proxy_level_" .. self.current_level 301 | msg.post(proxy, "disable") 302 | msg.post(proxy, "final") 303 | msg.post(proxy, "unload") 304 | elseif message_id == hash("proxy_loaded") then 305 | msg.post(sender, "init") 306 | msg.post(sender, "enable") 307 | end 308 | end 309 | ``` 310 | 1. Keep track of the currently loaded level so it can be unloaded and it is possible to advance to the next one. 311 | 2. Load next level. Note that there is no check if there actually exists a next level. 312 | 3. Unload the currently loaded level. 313 | 314 | Open "level.script" and add a message to the level gui when the game is finished at the end of `on_input()`: 315 | 316 | ```lua 317 | ... 318 | -- check if the board is solved 319 | if all_correct(self.bricks) then 320 | msg.post("#gui", "level_completed") -- [1] 321 | self.completed = true 322 | end 323 | end 324 | ... 325 | ``` 326 | 1. Tell the GUI to show the level completed panel. 327 | 328 | Finally, open "level.go" and add "level.gui" as a GUI component to the game object. Make sure to set the *Id* property of the component to "gui". 329 | 330 | Run the game. You should be able to select a game, go back to the level selection screen (with the "back" button) and also start the next level when one is finished. 331 | 332 | ## Start screen 333 | 334 | The final piece of the puzzle is the start screen: 335 | 336 | Create a new GUI file and call it "start.gui". 337 | 338 | Add "headings" to the *Font* section and the "bricks" atlas to the *Textures* section of the GUI. 339 | 340 | Build the front screen. Add logo and a "start" button: 341 | 342 | 343 | 344 | Create a new GUI script file and call it "start.gui_script". 345 | 346 | Open "start.gui_script" and change the script to the following: 347 | 348 | ```lua 349 | function init(self) 350 | msg.post("#", "show_start") -- [1] 351 | self.active = false 352 | end 353 | 354 | function on_message(self, message_id, message, sender) 355 | if message_id == hash("show_start") then -- [2] 356 | msg.post("#", "enable") 357 | self.active = true 358 | elseif message_id == hash("hide_start") then 359 | msg.post("#", "disable") 360 | self.active = false 361 | end 362 | end 363 | 364 | function on_input(self, action_id, action) 365 | if action_id == hash("touch") and action.pressed and self.active then 366 | local start = gui.get_node("start") 367 | if gui.pick_node(start, action.x, action.y) then -- [3] 368 | msg.post("#", "hide_start") 369 | msg.post("#level_select", "show_level_select") 370 | end 371 | end 372 | end 373 | ``` 374 | 1. Start by showing this screen. 375 | 2. Messages to show and hide this screen. 376 | 3. If the player presses the "start" button, hide this screen and tell the level selection GUI to show itself. 377 | 378 | Open "start.gui" and set the *Script* property on the root node to the new script. 379 | 380 | Open "main.collection" and add "start.gui" as a GUI component to the "guis" game object. 381 | 382 | Now open "level_select.gui" and add a "back" button. You can copy and paste the one you made in "level.gui" if you want. 383 | 384 | 385 | 386 | Open "level_select.gui_script" and add the code for returning to the start screen in `on_input()`: 387 | 388 | ```lua 389 | function on_input(self, action_id, action) 390 | if action_id == hash("touch") and action.pressed and self.active then 391 | for n = 1,4 do 392 | local node = gui.get_node("level_" .. n) 393 | if gui.pick_node(node, action.x, action.y) then 394 | msg.post("/loader#loader", "load_level", { level = n }) 395 | msg.post("#level_select", "hide_level_select") 396 | end 397 | end 398 | 399 | local back = gui.get_node("back") -- [1] 400 | if gui.pick_node(back, action.x, action.y) then 401 | msg.post("#level_select", "hide_level_select") 402 | msg.post("#start", "show_start") 403 | end 404 | end 405 | end 406 | ``` 407 | 1. Check if the player clicks "back". If so, hide this GUI and show the start screen. 408 | 409 | Also edit the `init()` function so the level select GUI is hidden on startup. 410 | 411 | ``` 412 | function init(self) 413 | msg.post(".", "acquire_input_focus") 414 | msg.post("#", "hide_level_select") -- [1] 415 | self.active = false 416 | end 417 | ``` 418 | 1. Hide the GUI on startup 419 | 420 | And that's it. You are done! Run the game and verify that everything works as expected. 421 | 422 | The full source code for the project at this stage can be found in the [tutorial-done branch](https://github.com/defold/tutorial-colorslide/tree/tutorial-done). 423 | 424 | ## What next? 425 | 426 | This GUI implementation is pretty simple. Each screen deals with its own state and contains the code to hand over control to the next screen by sending messages to the other GUI component. 427 | 428 | If your game does not feature advanced GUI flows this method is sufficient and clear enough. However, for advanced GUIs things can get hairy and in that case you might want to use some sort of screen manager that controls the flow from a central location. You can either roll your own or include an existing one as a library. Check out asset portal for community written [GUI libraries](https://defold.com/tags/stars/gui/). 429 | 430 | If you want to continue experimenting with this tutorial project, here are some exercise suggestions: 431 | 432 | 1. You may have noticed that the "Level 1" header while playing a level is static. Add functionality so the header text shows the correct level number. 433 | 2. Implement unlocking of levels. Start the game with all but the first level locked and unlock them one by one as the game progresses. 434 | 3. Implement saving of the level unlock progression state. 435 | 4. Fix the case where the player completes the last level and there is no "next" one. 436 | 5. Use GUI templates to create the buttons. 437 | 6. Make the buttons response visually (react to press) and with sound. 438 | 7. Add sound to the game. 439 | 8. Create a solution to when there are more levels than what fits the screen. 440 | 441 | Check out [the documentation pages](https://defold.com/learn) for more examples, tutorials, manuals and API docs. 442 | 443 | If you run into trouble, help is available in [our forum](https://forum.defold.com). 444 | 445 | Happy Defolding! 446 | --- 447 | -------------------------------------------------------------------------------- /assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/.DS_Store -------------------------------------------------------------------------------- /assets/bricks.atlas: -------------------------------------------------------------------------------- 1 | images { 2 | image: "/assets/images/blue.png" 3 | } 4 | images { 5 | image: "/assets/images/green.png" 6 | } 7 | images { 8 | image: "/assets/images/grey.png" 9 | } 10 | images { 11 | image: "/assets/images/red.png" 12 | } 13 | images { 14 | image: "/assets/images/yellow.png" 15 | } 16 | images { 17 | image: "/assets/images/eyeball_angry_left.png" 18 | } 19 | images { 20 | image: "/assets/images/eyeball_angry_right.png" 21 | } 22 | images { 23 | image: "/assets/images/eyeball_happy_left.png" 24 | } 25 | images { 26 | image: "/assets/images/eyeball_happy_right.png" 27 | } 28 | images { 29 | image: "/assets/images/left_angry.png" 30 | } 31 | images { 32 | image: "/assets/images/left_angry_blink.png" 33 | } 34 | images { 35 | image: "/assets/images/left_happy.png" 36 | } 37 | images { 38 | image: "/assets/images/left_happy_blink.png" 39 | } 40 | images { 41 | image: "/assets/images/right_angry.png" 42 | } 43 | images { 44 | image: "/assets/images/right_angry_blink.png" 45 | } 46 | images { 47 | image: "/assets/images/right_happy.png" 48 | } 49 | images { 50 | image: "/assets/images/right_happy_blink.png" 51 | } 52 | images { 53 | image: "/assets/images/mouth_angry_closed.png" 54 | } 55 | images { 56 | image: "/assets/images/mouth_angry_open.png" 57 | } 58 | images { 59 | image: "/assets/images/mouth_happy_closed.png" 60 | } 61 | images { 62 | image: "/assets/images/mouth_happy_open.png" 63 | } 64 | images { 65 | image: "/assets/images/logo.png" 66 | } 67 | images { 68 | image: "/assets/images/button.png" 69 | } 70 | margin: 0 71 | extrude_borders: 0 72 | inner_padding: 0 73 | -------------------------------------------------------------------------------- /assets/colorboys.afphoto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/colorboys.afphoto -------------------------------------------------------------------------------- /assets/colorboys_face.afphoto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/colorboys_face.afphoto -------------------------------------------------------------------------------- /assets/fonts/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/fonts/.DS_Store -------------------------------------------------------------------------------- /assets/fonts/open_sans/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /assets/fonts/open_sans/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/fonts/open_sans/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/passion_one/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Fontstage (info@fontstage.com), with Reserved Font Names, 'Passion' 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /assets/fonts/passion_one/PassionOne-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/fonts/passion_one/PassionOne-Regular.ttf -------------------------------------------------------------------------------- /assets/headings.font: -------------------------------------------------------------------------------- 1 | font: "/assets/fonts/passion_one/PassionOne-Regular.ttf" 2 | material: "/builtins/fonts/font-df.material" 3 | size: 32 4 | antialias: 1 5 | alpha: 1.0 6 | outline_alpha: 0.0 7 | outline_width: 0.0 8 | shadow_alpha: 0.0 9 | shadow_blur: 0 10 | shadow_x: 0.0 11 | shadow_y: 0.0 12 | extra_characters: "" 13 | output_format: TYPE_DISTANCE_FIELD 14 | all_chars: false 15 | cache_width: 0 16 | cache_height: 0 17 | -------------------------------------------------------------------------------- /assets/images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/.DS_Store -------------------------------------------------------------------------------- /assets/images/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/blue.png -------------------------------------------------------------------------------- /assets/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/button.png -------------------------------------------------------------------------------- /assets/images/eyeball_angry_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/eyeball_angry_left.png -------------------------------------------------------------------------------- /assets/images/eyeball_angry_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/eyeball_angry_right.png -------------------------------------------------------------------------------- /assets/images/eyeball_happy_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/eyeball_happy_left.png -------------------------------------------------------------------------------- /assets/images/eyeball_happy_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/eyeball_happy_right.png -------------------------------------------------------------------------------- /assets/images/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/green.png -------------------------------------------------------------------------------- /assets/images/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/grey.png -------------------------------------------------------------------------------- /assets/images/left_angry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/left_angry.png -------------------------------------------------------------------------------- /assets/images/left_angry_blink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/left_angry_blink.png -------------------------------------------------------------------------------- /assets/images/left_happy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/left_happy.png -------------------------------------------------------------------------------- /assets/images/left_happy_blink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/left_happy_blink.png -------------------------------------------------------------------------------- /assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/logo.png -------------------------------------------------------------------------------- /assets/images/mouth_angry_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/mouth_angry_closed.png -------------------------------------------------------------------------------- /assets/images/mouth_angry_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/mouth_angry_open.png -------------------------------------------------------------------------------- /assets/images/mouth_happy_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/mouth_happy_closed.png -------------------------------------------------------------------------------- /assets/images/mouth_happy_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/mouth_happy_open.png -------------------------------------------------------------------------------- /assets/images/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/red.png -------------------------------------------------------------------------------- /assets/images/right_angry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/right_angry.png -------------------------------------------------------------------------------- /assets/images/right_angry_blink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/right_angry_blink.png -------------------------------------------------------------------------------- /assets/images/right_happy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/right_happy.png -------------------------------------------------------------------------------- /assets/images/right_happy_blink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/right_happy_blink.png -------------------------------------------------------------------------------- /assets/images/tiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/tiles.png -------------------------------------------------------------------------------- /assets/images/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/assets/images/yellow.png -------------------------------------------------------------------------------- /assets/level.tilesource: -------------------------------------------------------------------------------- 1 | image: "/assets/images/tiles.png" 2 | tile_width: 128 3 | tile_height: 128 4 | tile_margin: 0 5 | tile_spacing: 0 6 | collision: "" 7 | material_tag: "tile" 8 | collision_groups: "default" 9 | animations { 10 | id: "anim" 11 | start_tile: 1 12 | end_tile: 1 13 | playback: PLAYBACK_ONCE_FORWARD 14 | fps: 30 15 | flip_horizontal: 0 16 | flip_vertical: 0 17 | } 18 | extrude_borders: 2 19 | inner_padding: 0 20 | -------------------------------------------------------------------------------- /doc/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/.DS_Store -------------------------------------------------------------------------------- /doc/level_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_gui.png -------------------------------------------------------------------------------- /doc/level_gui@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_gui@2x.png -------------------------------------------------------------------------------- /doc/level_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_select.png -------------------------------------------------------------------------------- /doc/level_select@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_select@2x.png -------------------------------------------------------------------------------- /doc/level_select_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_select_back.png -------------------------------------------------------------------------------- /doc/level_select_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_select_back@2x.png -------------------------------------------------------------------------------- /doc/level_select_script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_select_script.png -------------------------------------------------------------------------------- /doc/level_select_script@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/level_select_script@2x.png -------------------------------------------------------------------------------- /doc/main_collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/main_collection.png -------------------------------------------------------------------------------- /doc/main_collection@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/main_collection@2x.png -------------------------------------------------------------------------------- /doc/main_proxies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/main_proxies.png -------------------------------------------------------------------------------- /doc/main_proxies@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/main_proxies@2x.png -------------------------------------------------------------------------------- /doc/main_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/main_proxy.png -------------------------------------------------------------------------------- /doc/main_proxy@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/main_proxy@2x.png -------------------------------------------------------------------------------- /doc/socket_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/socket_name.png -------------------------------------------------------------------------------- /doc/socket_name@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/socket_name@2x.png -------------------------------------------------------------------------------- /doc/start_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/start_gui.png -------------------------------------------------------------------------------- /doc/start_gui@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defold/tutorial-colorslide/702ce4713bf0ed161d49bf992ec7c13be320ab4f/doc/start_gui@2x.png -------------------------------------------------------------------------------- /game.project: -------------------------------------------------------------------------------- 1 | [bootstrap] 2 | main_collection = /main/main.collectionc 3 | 4 | [project] 5 | title = Colorslide 6 | 7 | [display] 8 | width = 640 9 | height = 1136 10 | high_dpi = 1 11 | 12 | [sprite] 13 | max_count = 512 14 | 15 | [physics] 16 | debug = 1 17 | 18 | [script] 19 | shared_state = 1 20 | -------------------------------------------------------------------------------- /input/game.input_binding: -------------------------------------------------------------------------------- 1 | mouse_trigger { 2 | input: MOUSE_BUTTON_1 3 | action: "touch" 4 | } 5 | -------------------------------------------------------------------------------- /main/brick/brick.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "brick" 4 | prototype: "/main/brick/brick.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "facecontroller" 25 | data: "components {\n" 26 | " id: \"script\"\n" 27 | " component: \"/main/brick/face.script\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | embedded_instances { 59 | id: "eye_left" 60 | data: "embedded_components {\n" 61 | " id: \"sprite\"\n" 62 | " type: \"sprite\"\n" 63 | " data: \"tile_set: \\\"/assets/bricks.atlas\\\"\\n" 64 | "default_animation: \\\"left_angry\\\"\\n" 65 | "material: \\\"/builtins/materials/sprite.material\\\"\\n" 66 | "blend_mode: BLEND_MODE_ALPHA\\n" 67 | "\"\n" 68 | " position {\n" 69 | " x: 0.0\n" 70 | " y: 0.0\n" 71 | " z: 0.0\n" 72 | " }\n" 73 | " rotation {\n" 74 | " x: 0.0\n" 75 | " y: 0.0\n" 76 | " z: 0.0\n" 77 | " w: 1.0\n" 78 | " }\n" 79 | "}\n" 80 | "" 81 | position { 82 | x: -15.0 83 | y: 12.0 84 | z: 0.01 85 | } 86 | rotation { 87 | x: 0.0 88 | y: 0.0 89 | z: 0.0 90 | w: 1.0 91 | } 92 | scale3 { 93 | x: 1.0 94 | y: 1.0 95 | z: 1.0 96 | } 97 | } 98 | embedded_instances { 99 | id: "eye_right" 100 | data: "embedded_components {\n" 101 | " id: \"sprite\"\n" 102 | " type: \"sprite\"\n" 103 | " data: \"tile_set: \\\"/assets/bricks.atlas\\\"\\n" 104 | "default_animation: \\\"right_angry\\\"\\n" 105 | "material: \\\"/builtins/materials/sprite.material\\\"\\n" 106 | "blend_mode: BLEND_MODE_ALPHA\\n" 107 | "\"\n" 108 | " position {\n" 109 | " x: 0.0\n" 110 | " y: 0.0\n" 111 | " z: 0.0\n" 112 | " }\n" 113 | " rotation {\n" 114 | " x: 0.0\n" 115 | " y: 0.0\n" 116 | " z: 0.0\n" 117 | " w: 1.0\n" 118 | " }\n" 119 | "}\n" 120 | "" 121 | position { 122 | x: 15.0 123 | y: 12.0 124 | z: 0.01 125 | } 126 | rotation { 127 | x: 0.0 128 | y: 0.0 129 | z: 0.0 130 | w: 1.0 131 | } 132 | scale3 { 133 | x: 1.0 134 | y: 1.0 135 | z: 1.0 136 | } 137 | } 138 | embedded_instances { 139 | id: "eyeball_left" 140 | data: "embedded_components {\n" 141 | " id: \"sprite\"\n" 142 | " type: \"sprite\"\n" 143 | " data: \"tile_set: \\\"/assets/bricks.atlas\\\"\\n" 144 | "default_animation: \\\"eyeball_angry_left\\\"\\n" 145 | "material: \\\"/builtins/materials/sprite.material\\\"\\n" 146 | "blend_mode: BLEND_MODE_ALPHA\\n" 147 | "\"\n" 148 | " position {\n" 149 | " x: 0.0\n" 150 | " y: 0.0\n" 151 | " z: 0.0\n" 152 | " }\n" 153 | " rotation {\n" 154 | " x: 0.0\n" 155 | " y: 0.0\n" 156 | " z: 0.0\n" 157 | " w: 1.0\n" 158 | " }\n" 159 | "}\n" 160 | "" 161 | position { 162 | x: -15.0 163 | y: 12.0 164 | z: 0.0 165 | } 166 | rotation { 167 | x: 0.0 168 | y: 0.0 169 | z: 0.0 170 | w: 1.0 171 | } 172 | scale3 { 173 | x: 1.0 174 | y: 1.0 175 | z: 1.0 176 | } 177 | } 178 | embedded_instances { 179 | id: "eyeball_right" 180 | data: "embedded_components {\n" 181 | " id: \"sprite\"\n" 182 | " type: \"sprite\"\n" 183 | " data: \"tile_set: \\\"/assets/bricks.atlas\\\"\\n" 184 | "default_animation: \\\"eyeball_angry_right\\\"\\n" 185 | "material: \\\"/builtins/materials/sprite.material\\\"\\n" 186 | "blend_mode: BLEND_MODE_ALPHA\\n" 187 | "\"\n" 188 | " position {\n" 189 | " x: 0.0\n" 190 | " y: 0.0\n" 191 | " z: 0.0\n" 192 | " }\n" 193 | " rotation {\n" 194 | " x: 0.0\n" 195 | " y: 0.0\n" 196 | " z: 0.0\n" 197 | " w: 1.0\n" 198 | " }\n" 199 | "}\n" 200 | "" 201 | position { 202 | x: 15.0 203 | y: 12.0 204 | z: 0.0 205 | } 206 | rotation { 207 | x: 0.0 208 | y: 0.0 209 | z: 0.0 210 | w: 1.0 211 | } 212 | scale3 { 213 | x: 1.0 214 | y: 1.0 215 | z: 1.0 216 | } 217 | } 218 | embedded_instances { 219 | id: "mouth" 220 | data: "embedded_components {\n" 221 | " id: \"sprite\"\n" 222 | " type: \"sprite\"\n" 223 | " data: \"tile_set: \\\"/assets/bricks.atlas\\\"\\n" 224 | "default_animation: \\\"mouth_angry_closed\\\"\\n" 225 | "material: \\\"/builtins/materials/sprite.material\\\"\\n" 226 | "blend_mode: BLEND_MODE_ALPHA\\n" 227 | "\"\n" 228 | " position {\n" 229 | " x: 0.0\n" 230 | " y: 0.0\n" 231 | " z: 0.0\n" 232 | " }\n" 233 | " rotation {\n" 234 | " x: 0.0\n" 235 | " y: 0.0\n" 236 | " z: 0.0\n" 237 | " w: 1.0\n" 238 | " }\n" 239 | "}\n" 240 | "" 241 | position { 242 | x: 0.0 243 | y: -12.0 244 | z: 0.0 245 | } 246 | rotation { 247 | x: 0.0 248 | y: 0.0 249 | z: 0.0 250 | w: 1.0 251 | } 252 | scale3 { 253 | x: 1.0 254 | y: 1.0 255 | z: 1.0 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /main/brick/brick.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "script" 3 | component: "/main/brick/brick.script" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | embedded_components { 17 | id: "sprite" 18 | type: "sprite" 19 | data: "tile_set: \"/assets/bricks.atlas\"\n" 20 | "default_animation: \"blue\"\n" 21 | "material: \"/builtins/materials/sprite.material\"\n" 22 | "blend_mode: BLEND_MODE_ALPHA\n" 23 | "" 24 | position { 25 | x: 0.0 26 | y: 0.0 27 | z: 0.0 28 | } 29 | rotation { 30 | x: 0.0 31 | y: 0.0 32 | z: 0.0 33 | w: 1.0 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/brick/brick.script: -------------------------------------------------------------------------------- 1 | go.property("color", 0) 2 | 3 | local colors = require("main.colors") 4 | 5 | local anims = { [ colors.RED ] = hash("red"), 6 | [ colors.BLUE ] = hash("blue"), 7 | [ colors.GREEN ] = hash("green"), 8 | [ colors.YELLOW ] = hash("yellow"), 9 | [ colors.GREY ] = hash("grey") } 10 | 11 | function init(self) 12 | if self.color > 0 then 13 | local anim = anims[self.color] 14 | msg.post("#sprite", "play_animation", { id = anim }) 15 | end 16 | end 17 | 18 | function on_message(self, message_id, message, sender) 19 | if message_id == hash("on_correct_color") then 20 | local state = "angry" 21 | if message.correct then 22 | state = "happy" 23 | end 24 | msg.post("facecontroller#script", "set_state", { state = state }) 25 | end 26 | end -------------------------------------------------------------------------------- /main/brick/face.script: -------------------------------------------------------------------------------- 1 | -- a few dummy properties used as timers. 2 | go.property("blink", 0) 3 | go.property("minimove", 0) 4 | go.property("micromove", 0) 5 | 6 | local look 7 | local blink 8 | local minimove 9 | local micromove 10 | 11 | look = function(self) 12 | msg.post("eye_left#sprite", "play_animation", { id = hash("left_" .. self.state ) }) 13 | msg.post("eye_right#sprite", "play_animation", { id = hash("right_" .. self.state) }) 14 | msg.post("eyeball_left#sprite", "play_animation", { id = hash("eyeball_" .. self.state .. "_left" ) }) 15 | msg.post("eyeball_right#sprite", "play_animation", { id = hash("eyeball_" .. self.state .. "_right" ) }) 16 | msg.post("eyeball_left#sprite", "enable") 17 | msg.post("eyeball_right#sprite", "enable") 18 | 19 | local wait = math.random(4, 20) / 2 20 | go.animate("#", "blink", go.PLAYBACK_ONCE_FORWARD, 1, go.EASING_LINEAR, wait, 0, blink) 21 | end 22 | 23 | blink = function(self) 24 | go.cancel_animations("#", "blink") 25 | msg.post("eye_left#sprite", "play_animation", { id = hash("left_" .. self.state .. "_blink") }) 26 | msg.post("eye_right#sprite", "play_animation", { id = hash("right_" .. self.state .. "_blink") }) 27 | msg.post("eyeball_left#sprite", "disable") 28 | msg.post("eyeball_right#sprite", "disable") 29 | 30 | local wait = math.random() / 10 + 0.1 31 | go.animate("#", "blink", go.PLAYBACK_ONCE_FORWARD, 1, go.EASING_LINEAR, wait, 0, look) 32 | end 33 | 34 | minimove = function(self) 35 | local x = math.random() * 4 - 2 36 | local y = math.random() * 2 - 1 37 | local offset = vmath.vector3(x, y, 0) 38 | 39 | go.set_position(self.left_pos + offset, "eye_left") 40 | go.set_position(self.right_pos + offset, "eye_right") 41 | 42 | local wait = math.random(5, 20) / 20 43 | if self.state == "happy" then 44 | wait = math.random(8, 20) / 15 45 | end 46 | go.animate("#", "minimove", go.PLAYBACK_ONCE_FORWARD, 1, go.EASING_LINEAR, wait, 0, minimove) 47 | end 48 | 49 | micromove = function(self) 50 | local s = math.random(98, 100) / 100 51 | 52 | go.set_scale(s, "eye_left") 53 | go.set_scale(s, "eye_right") 54 | 55 | local wait = math.random() / 10 56 | go.animate("#", "micromove", go.PLAYBACK_ONCE_FORWARD, 1, go.EASING_LINEAR, wait, 0, micromove) 57 | end 58 | 59 | function init(self) 60 | self.state = "angry" 61 | 62 | -- parent every part of the face to the brick for easy animation 63 | local root = go.get_id("brick") 64 | msg.post("eye_left", "set_parent", { parent_id = root }) 65 | msg.post("eye_right", "set_parent", { parent_id = root }) 66 | msg.post("eyeball_left", "set_parent", { parent_id = root }) 67 | msg.post("eyeball_right", "set_parent", { parent_id = root }) 68 | msg.post("mouth", "set_parent", { parent_id = root }) 69 | 70 | msg.post("#", "start") 71 | end 72 | 73 | function on_message(self, message_id, message, sender) 74 | if message_id == hash("start") then 75 | self.left_pos = go.get_position("eye_left") 76 | self.right_pos = go.get_position("eye_right") 77 | look(self) 78 | minimove(self) 79 | micromove(self) 80 | elseif message_id == hash("set_state") then 81 | self.state = message.state 82 | msg.post("mouth#sprite", "play_animation", { id = hash("mouth_" .. self.state .. "_closed") }) 83 | blink(self) 84 | elseif message_id == hash("start_drag") then 85 | msg.post("mouth#sprite", "play_animation", { id = hash("mouth_" .. self.state .. "_open") }) 86 | go.set("eyeball_left#sprite", "scale.y", 0.8) 87 | go.set("eyeball_right#sprite", "scale.y", 0.8) 88 | elseif message_id == hash("end_drag") then 89 | msg.post("mouth#sprite", "play_animation", { id = hash("mouth_" .. self.state .. "_closed") }) 90 | go.set("eyeball_left#sprite", "scale.y", 1) 91 | go.set("eyeball_right#sprite", "scale.y", 1) 92 | end 93 | end 94 | 95 | function on_reload(self) 96 | msg.post("#", "end_drag") 97 | end 98 | -------------------------------------------------------------------------------- /main/colors.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | -- board tile colors 4 | M.TILE_BLANK = 1 5 | M.TILE_GREY = 2 6 | M.TILE_RED = 3 7 | M.TILE_YELLOW = 4 8 | M.TILE_GREEN = 5 9 | M.TILE_BLUE = 6 10 | 11 | -- brick colors 12 | M.GREY = 8 13 | M.RED = 9 14 | M.YELLOW = 10 15 | M.GREEN = 11 16 | M.BLUE = 12 17 | 18 | -- compare colors. bricks and board colors are from different 19 | -- parts of the tileset so they cannot be directly compared. 20 | M.compare = function(brick_color, board_color) 21 | return brick_color - 6 == board_color 22 | end 23 | 24 | return M -------------------------------------------------------------------------------- /main/level.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "level" 3 | component: "/main/level.script" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | embedded_components { 17 | id: "brickfactory" 18 | type: "collectionfactory" 19 | data: "prototype: \"/main/brick/brick.collection\"\n" 20 | "load_dynamically: false\n" 21 | "" 22 | position { 23 | x: 0.0 24 | y: 0.0 25 | z: 0.0 26 | } 27 | rotation { 28 | x: 0.0 29 | y: 0.0 30 | z: 0.0 31 | w: 1.0 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /main/level.script: -------------------------------------------------------------------------------- 1 | local colors = require("main.colors") 2 | 3 | local function make_empty_slot(x, y) 4 | local l = x - 1 .. ":" .. y 5 | local r = x + 1 .. ":" .. y 6 | local u = x .. ":" .. y + 1 7 | local d = x .. ":" .. y - 1 8 | return { x = x, y = y, neighbors = { l, r, u, d } } 9 | end 10 | 11 | local function make_brick(brick_go, color, correct) 12 | return { go = brick_go, color = color, correct = correct} 13 | end 14 | 15 | local function empty_neighbor(id, empty) 16 | for i, v in ipairs(empty.neighbors) do 17 | if id == v then 18 | return true 19 | end 20 | end 21 | return false 22 | end 23 | 24 | local function brick_pos(x, y) 25 | return vmath.vector3(x * 128 - 64, y * 128 - 64, 0.01) 26 | end 27 | 28 | local function populate_level(self) 29 | local x, y, w, h = tilemap.get_bounds("board#tiles") 30 | 31 | for ix=x,x+w-1 do 32 | for iy=y, h+y-1 do 33 | local brick_color = tilemap.get_tile("board#tiles", "setup", ix, iy) 34 | local board_color = tilemap.get_tile("board#tiles", "board", ix, iy) 35 | 36 | -- clear the setup layer tile 37 | tilemap.set_tile("board#tiles", "setup", ix, iy, 0) 38 | 39 | local pos = brick_pos(ix, iy) 40 | local props = {} 41 | if brick_color > 0 then 42 | props[hash("/brick")] = { color = brick_color } 43 | local ids = collectionfactory.create("#brickfactory", pos, nil, props) 44 | 45 | -- store the root object ("brick") for each instance. 46 | local brick = ids[hash("/brick")] 47 | local correct = colors.compare(brick_color, board_color) 48 | self.bricks[ix .. ":" .. iy] = make_brick(brick, brick_color, correct) 49 | 50 | msg.post(brick, "on_correct_color", { correct = correct }) 51 | end 52 | 53 | if brick_color == 0 and board_color > 0 then 54 | self.empty_slot = make_empty_slot(ix, iy) 55 | end 56 | end 57 | end 58 | end 59 | 60 | local function all_correct(bricks) 61 | for k, b in pairs(bricks) do 62 | if not b.correct then 63 | return false 64 | end 65 | end 66 | return true 67 | end 68 | 69 | local function bounce(bricks) 70 | for k, b in pairs(bricks) do 71 | local brick = b.go 72 | local pos = go.get_position(brick) 73 | local delay = 0.3 + math.random() / 6 74 | go.animate(brick, "position.y", go.PLAYBACK_LOOP_PINGPONG, pos.y + 30, go.EASING_OUTSINE, 0.33, delay) 75 | end 76 | end 77 | 78 | function init(self) 79 | self.bricks = {} 80 | self.completed = false 81 | populate_level(self) 82 | msg.post(".", "acquire_input_focus") 83 | end 84 | 85 | function on_input(self, action_id, action) 86 | if action_id == hash("touch") and not self.completed then 87 | if action.pressed then 88 | local x = math.ceil(action.x / 128) 89 | local y = math.ceil(action.y / 128) 90 | local brick_id = x .. ":" .. y 91 | if empty_neighbor(brick_id, self.empty_slot) and self.bricks[brick_id] then 92 | -- slide the brick into the empty space 93 | local brick = self.bricks[brick_id].go 94 | local empty_x = self.empty_slot.x 95 | local empty_y = self.empty_slot.y 96 | 97 | -- update the moved brick 98 | local brick_color = self.bricks[brick_id].color 99 | local board_color = tilemap.get_tile("board#tiles", "board", empty_x, empty_y) 100 | local correct = colors.compare(brick_color, board_color) 101 | self.bricks[empty_x .. ":" .. empty_y] = make_brick(brick, brick_color, correct) 102 | self.bricks[x .. ":" .. y] = nil 103 | 104 | -- there is a new empty slot 105 | self.empty_slot = make_empty_slot(x, y) 106 | 107 | -- animate the brick into place 108 | local target = brick_pos(empty_x, empty_y) 109 | go.animate(brick, "position", go.PLAYBACK_ONCE_FORWARD, target, go.EASING_INOUTQUAD, 0.2, 0, function() 110 | msg.post(brick, "on_correct_color", { correct = correct }) 111 | 112 | if self.completed then 113 | bounce(self.bricks) 114 | end 115 | end) 116 | 117 | if all_correct(self.bricks) then 118 | self.completed = true 119 | end 120 | end 121 | end 122 | end 123 | end -------------------------------------------------------------------------------- /main/level_1/level_1.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "level" 4 | prototype: "/main/level.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "board" 25 | data: "components {\n" 26 | " id: \"tiles\"\n" 27 | " component: \"/main/level_1/level_1.tilemap\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /main/level_1/level_1.tilemap: -------------------------------------------------------------------------------- 1 | tile_set: "/assets/level.tilesource" 2 | layers { 3 | id: "board" 4 | z: 0.0 5 | is_visible: 1 6 | cell { 7 | x: 1 8 | y: 3 9 | tile: 5 10 | h_flip: 0 11 | v_flip: 0 12 | } 13 | cell { 14 | x: 2 15 | y: 3 16 | tile: 5 17 | h_flip: 0 18 | v_flip: 0 19 | } 20 | cell { 21 | x: 3 22 | y: 3 23 | tile: 5 24 | h_flip: 0 25 | v_flip: 0 26 | } 27 | cell { 28 | x: 1 29 | y: 4 30 | tile: 0 31 | h_flip: 0 32 | v_flip: 0 33 | } 34 | cell { 35 | x: 2 36 | y: 4 37 | tile: 3 38 | h_flip: 0 39 | v_flip: 0 40 | } 41 | cell { 42 | x: 3 43 | y: 4 44 | tile: 3 45 | h_flip: 0 46 | v_flip: 0 47 | } 48 | } 49 | layers { 50 | id: "setup" 51 | z: 0.0 52 | is_visible: 1 53 | cell { 54 | x: 1 55 | y: 3 56 | tile: 9 57 | h_flip: 0 58 | v_flip: 0 59 | } 60 | cell { 61 | x: 2 62 | y: 3 63 | tile: 11 64 | h_flip: 0 65 | v_flip: 0 66 | } 67 | cell { 68 | x: 3 69 | y: 3 70 | tile: 11 71 | h_flip: 0 72 | v_flip: 0 73 | } 74 | cell { 75 | x: 2 76 | y: 4 77 | tile: 9 78 | h_flip: 0 79 | v_flip: 0 80 | } 81 | cell { 82 | x: 3 83 | y: 4 84 | tile: 11 85 | h_flip: 0 86 | v_flip: 0 87 | } 88 | } 89 | material: "/builtins/materials/tile_map.material" 90 | blend_mode: BLEND_MODE_ALPHA 91 | -------------------------------------------------------------------------------- /main/level_2/level_2.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "level" 4 | prototype: "/main/level.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "board" 25 | data: "components {\n" 26 | " id: \"tiles\"\n" 27 | " component: \"/main/level_2/level_2.tilemap\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /main/level_2/level_2.tilemap: -------------------------------------------------------------------------------- 1 | tile_set: "/assets/level.tilesource" 2 | layers { 3 | id: "board" 4 | z: 0.0 5 | is_visible: 1 6 | cell { 7 | x: 1 8 | y: 2 9 | tile: 2 10 | h_flip: 0 11 | v_flip: 0 12 | } 13 | cell { 14 | x: 2 15 | y: 2 16 | tile: 2 17 | h_flip: 0 18 | v_flip: 0 19 | } 20 | cell { 21 | x: 3 22 | y: 2 23 | tile: 4 24 | h_flip: 0 25 | v_flip: 0 26 | } 27 | cell { 28 | x: 1 29 | y: 3 30 | tile: 2 31 | h_flip: 0 32 | v_flip: 0 33 | } 34 | cell { 35 | x: 2 36 | y: 3 37 | tile: 2 38 | h_flip: 0 39 | v_flip: 0 40 | } 41 | cell { 42 | x: 3 43 | y: 3 44 | tile: 4 45 | h_flip: 0 46 | v_flip: 0 47 | } 48 | cell { 49 | x: 1 50 | y: 4 51 | tile: 3 52 | h_flip: 0 53 | v_flip: 0 54 | } 55 | cell { 56 | x: 2 57 | y: 4 58 | tile: 3 59 | h_flip: 0 60 | v_flip: 0 61 | } 62 | cell { 63 | x: 3 64 | y: 4 65 | tile: 4 66 | h_flip: 0 67 | v_flip: 0 68 | } 69 | cell { 70 | x: 1 71 | y: 5 72 | tile: 3 73 | h_flip: 0 74 | v_flip: 0 75 | } 76 | cell { 77 | x: 2 78 | y: 5 79 | tile: 3 80 | h_flip: 0 81 | v_flip: 0 82 | } 83 | cell { 84 | x: 3 85 | y: 5 86 | tile: 0 87 | h_flip: 0 88 | v_flip: 0 89 | } 90 | } 91 | layers { 92 | id: "setup" 93 | z: 0.0 94 | is_visible: 1 95 | cell { 96 | x: 1 97 | y: 2 98 | tile: 8 99 | h_flip: 0 100 | v_flip: 0 101 | } 102 | cell { 103 | x: 2 104 | y: 2 105 | tile: 8 106 | h_flip: 0 107 | v_flip: 0 108 | } 109 | cell { 110 | x: 3 111 | y: 2 112 | tile: 8 113 | h_flip: 0 114 | v_flip: 0 115 | } 116 | cell { 117 | x: 1 118 | y: 3 119 | tile: 9 120 | h_flip: 0 121 | v_flip: 0 122 | } 123 | cell { 124 | x: 2 125 | y: 3 126 | tile: 8 127 | h_flip: 0 128 | v_flip: 0 129 | } 130 | cell { 131 | x: 3 132 | y: 3 133 | tile: 10 134 | h_flip: 0 135 | v_flip: 0 136 | } 137 | cell { 138 | x: 1 139 | y: 4 140 | tile: 9 141 | h_flip: 0 142 | v_flip: 0 143 | } 144 | cell { 145 | x: 2 146 | y: 4 147 | tile: 9 148 | h_flip: 0 149 | v_flip: 0 150 | } 151 | cell { 152 | x: 3 153 | y: 4 154 | tile: 10 155 | h_flip: 0 156 | v_flip: 0 157 | } 158 | cell { 159 | x: 2 160 | y: 5 161 | tile: 9 162 | h_flip: 0 163 | v_flip: 0 164 | } 165 | cell { 166 | x: 3 167 | y: 5 168 | tile: 10 169 | h_flip: 0 170 | v_flip: 0 171 | } 172 | } 173 | material: "/builtins/materials/tile_map.material" 174 | blend_mode: BLEND_MODE_ALPHA 175 | -------------------------------------------------------------------------------- /main/level_3/level_3.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "level" 4 | prototype: "/main/level.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "board" 25 | data: "components {\n" 26 | " id: \"tiles\"\n" 27 | " component: \"/main/level_3/level_3.tilemap\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /main/level_3/level_3.tilemap: -------------------------------------------------------------------------------- 1 | tile_set: "/assets/level.tilesource" 2 | layers { 3 | id: "board" 4 | z: 0.0 5 | is_visible: 1 6 | cell { 7 | x: 1 8 | y: 1 9 | tile: 2 10 | h_flip: 0 11 | v_flip: 0 12 | } 13 | cell { 14 | x: 2 15 | y: 1 16 | tile: 0 17 | h_flip: 0 18 | v_flip: 0 19 | } 20 | cell { 21 | x: 3 22 | y: 1 23 | tile: 4 24 | h_flip: 0 25 | v_flip: 0 26 | } 27 | cell { 28 | x: 0 29 | y: 2 30 | tile: 2 31 | h_flip: 0 32 | v_flip: 0 33 | } 34 | cell { 35 | x: 1 36 | y: 2 37 | tile: 2 38 | h_flip: 0 39 | v_flip: 0 40 | } 41 | cell { 42 | x: 2 43 | y: 2 44 | tile: 4 45 | h_flip: 0 46 | v_flip: 0 47 | } 48 | cell { 49 | x: 3 50 | y: 2 51 | tile: 4 52 | h_flip: 0 53 | v_flip: 0 54 | } 55 | cell { 56 | x: 4 57 | y: 2 58 | tile: 4 59 | h_flip: 0 60 | v_flip: 0 61 | } 62 | cell { 63 | x: 0 64 | y: 3 65 | tile: 2 66 | h_flip: 0 67 | v_flip: 0 68 | } 69 | cell { 70 | x: 1 71 | y: 3 72 | tile: 2 73 | h_flip: 0 74 | v_flip: 0 75 | } 76 | cell { 77 | x: 3 78 | y: 3 79 | tile: 4 80 | h_flip: 0 81 | v_flip: 0 82 | } 83 | cell { 84 | x: 4 85 | y: 3 86 | tile: 4 87 | h_flip: 0 88 | v_flip: 0 89 | } 90 | cell { 91 | x: 0 92 | y: 4 93 | tile: 2 94 | h_flip: 0 95 | v_flip: 0 96 | } 97 | cell { 98 | x: 1 99 | y: 4 100 | tile: 3 101 | h_flip: 0 102 | v_flip: 0 103 | } 104 | cell { 105 | x: 3 106 | y: 4 107 | tile: 4 108 | h_flip: 0 109 | v_flip: 0 110 | } 111 | cell { 112 | x: 4 113 | y: 4 114 | tile: 4 115 | h_flip: 0 116 | v_flip: 0 117 | } 118 | cell { 119 | x: 0 120 | y: 5 121 | tile: 3 122 | h_flip: 0 123 | v_flip: 0 124 | } 125 | cell { 126 | x: 1 127 | y: 5 128 | tile: 3 129 | h_flip: 0 130 | v_flip: 0 131 | } 132 | cell { 133 | x: 2 134 | y: 5 135 | tile: 3 136 | h_flip: 0 137 | v_flip: 0 138 | } 139 | cell { 140 | x: 3 141 | y: 5 142 | tile: 3 143 | h_flip: 0 144 | v_flip: 0 145 | } 146 | cell { 147 | x: 4 148 | y: 5 149 | tile: 4 150 | h_flip: 0 151 | v_flip: 0 152 | } 153 | cell { 154 | x: 1 155 | y: 6 156 | tile: 3 157 | h_flip: 0 158 | v_flip: 0 159 | } 160 | cell { 161 | x: 2 162 | y: 6 163 | tile: 3 164 | h_flip: 0 165 | v_flip: 0 166 | } 167 | cell { 168 | x: 3 169 | y: 6 170 | tile: 3 171 | h_flip: 0 172 | v_flip: 0 173 | } 174 | } 175 | layers { 176 | id: "setup" 177 | z: 0.0 178 | is_visible: 1 179 | cell { 180 | x: 1 181 | y: 1 182 | tile: 10 183 | h_flip: 0 184 | v_flip: 0 185 | } 186 | cell { 187 | x: 3 188 | y: 1 189 | tile: 10 190 | h_flip: 0 191 | v_flip: 0 192 | } 193 | cell { 194 | x: 0 195 | y: 2 196 | tile: 8 197 | h_flip: 0 198 | v_flip: 0 199 | } 200 | cell { 201 | x: 1 202 | y: 2 203 | tile: 10 204 | h_flip: 0 205 | v_flip: 0 206 | } 207 | cell { 208 | x: 2 209 | y: 2 210 | tile: 8 211 | h_flip: 0 212 | v_flip: 0 213 | } 214 | cell { 215 | x: 3 216 | y: 2 217 | tile: 10 218 | h_flip: 0 219 | v_flip: 0 220 | } 221 | cell { 222 | x: 4 223 | y: 2 224 | tile: 8 225 | h_flip: 0 226 | v_flip: 0 227 | } 228 | cell { 229 | x: 0 230 | y: 3 231 | tile: 9 232 | h_flip: 0 233 | v_flip: 0 234 | } 235 | cell { 236 | x: 1 237 | y: 3 238 | tile: 8 239 | h_flip: 0 240 | v_flip: 0 241 | } 242 | cell { 243 | x: 3 244 | y: 3 245 | tile: 10 246 | h_flip: 0 247 | v_flip: 0 248 | } 249 | cell { 250 | x: 4 251 | y: 3 252 | tile: 10 253 | h_flip: 0 254 | v_flip: 0 255 | } 256 | cell { 257 | x: 0 258 | y: 4 259 | tile: 9 260 | h_flip: 0 261 | v_flip: 0 262 | } 263 | cell { 264 | x: 1 265 | y: 4 266 | tile: 8 267 | h_flip: 0 268 | v_flip: 0 269 | } 270 | cell { 271 | x: 3 272 | y: 4 273 | tile: 10 274 | h_flip: 0 275 | v_flip: 0 276 | } 277 | cell { 278 | x: 4 279 | y: 4 280 | tile: 10 281 | h_flip: 0 282 | v_flip: 0 283 | } 284 | cell { 285 | x: 0 286 | y: 5 287 | tile: 9 288 | h_flip: 0 289 | v_flip: 0 290 | } 291 | cell { 292 | x: 1 293 | y: 5 294 | tile: 8 295 | h_flip: 0 296 | v_flip: 0 297 | } 298 | cell { 299 | x: 2 300 | y: 5 301 | tile: 9 302 | h_flip: 0 303 | v_flip: 0 304 | } 305 | cell { 306 | x: 3 307 | y: 5 308 | tile: 9 309 | h_flip: 0 310 | v_flip: 0 311 | } 312 | cell { 313 | x: 4 314 | y: 5 315 | tile: 10 316 | h_flip: 0 317 | v_flip: 0 318 | } 319 | cell { 320 | x: 1 321 | y: 6 322 | tile: 9 323 | h_flip: 0 324 | v_flip: 0 325 | } 326 | cell { 327 | x: 2 328 | y: 6 329 | tile: 9 330 | h_flip: 0 331 | v_flip: 0 332 | } 333 | cell { 334 | x: 3 335 | y: 6 336 | tile: 9 337 | h_flip: 0 338 | v_flip: 0 339 | } 340 | } 341 | material: "/builtins/materials/tile_map.material" 342 | blend_mode: BLEND_MODE_ALPHA 343 | -------------------------------------------------------------------------------- /main/level_4/level_4.collection: -------------------------------------------------------------------------------- 1 | name: "level_4" 2 | instances { 3 | id: "level" 4 | prototype: "/main/level.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "board" 25 | data: "components {\n" 26 | " id: \"tiles\"\n" 27 | " component: \"/main/level_4/level_4.tilemap\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /main/level_4/level_4.tilemap: -------------------------------------------------------------------------------- 1 | tile_set: "/assets/level.tilesource" 2 | layers { 3 | id: "board" 4 | z: 0.0 5 | is_visible: 1 6 | cell { 7 | x: 0 8 | y: 0 9 | tile: 5 10 | h_flip: 0 11 | v_flip: 0 12 | } 13 | cell { 14 | x: 1 15 | y: 0 16 | tile: 1 17 | h_flip: 0 18 | v_flip: 0 19 | } 20 | cell { 21 | x: 2 22 | y: 0 23 | tile: 1 24 | h_flip: 0 25 | v_flip: 0 26 | } 27 | cell { 28 | x: 3 29 | y: 0 30 | tile: 1 31 | h_flip: 0 32 | v_flip: 0 33 | } 34 | cell { 35 | x: 4 36 | y: 0 37 | tile: 5 38 | h_flip: 0 39 | v_flip: 0 40 | } 41 | cell { 42 | x: 0 43 | y: 1 44 | tile: 1 45 | h_flip: 0 46 | v_flip: 0 47 | } 48 | cell { 49 | x: 1 50 | y: 1 51 | tile: 1 52 | h_flip: 0 53 | v_flip: 0 54 | } 55 | cell { 56 | x: 2 57 | y: 1 58 | tile: 2 59 | h_flip: 0 60 | v_flip: 0 61 | } 62 | cell { 63 | x: 3 64 | y: 1 65 | tile: 1 66 | h_flip: 0 67 | v_flip: 0 68 | } 69 | cell { 70 | x: 4 71 | y: 1 72 | tile: 1 73 | h_flip: 0 74 | v_flip: 0 75 | } 76 | cell { 77 | x: 0 78 | y: 2 79 | tile: 1 80 | h_flip: 0 81 | v_flip: 0 82 | } 83 | cell { 84 | x: 1 85 | y: 2 86 | tile: 2 87 | h_flip: 0 88 | v_flip: 0 89 | } 90 | cell { 91 | x: 2 92 | y: 2 93 | tile: 2 94 | h_flip: 0 95 | v_flip: 0 96 | } 97 | cell { 98 | x: 3 99 | y: 2 100 | tile: 2 101 | h_flip: 0 102 | v_flip: 0 103 | } 104 | cell { 105 | x: 4 106 | y: 2 107 | tile: 1 108 | h_flip: 0 109 | v_flip: 0 110 | } 111 | cell { 112 | x: 1 113 | y: 3 114 | tile: 2 115 | h_flip: 0 116 | v_flip: 0 117 | } 118 | cell { 119 | x: 2 120 | y: 3 121 | tile: 3 122 | h_flip: 0 123 | v_flip: 0 124 | } 125 | cell { 126 | x: 3 127 | y: 3 128 | tile: 2 129 | h_flip: 0 130 | v_flip: 0 131 | } 132 | cell { 133 | x: 1 134 | y: 4 135 | tile: 3 136 | h_flip: 0 137 | v_flip: 0 138 | } 139 | cell { 140 | x: 2 141 | y: 4 142 | tile: 3 143 | h_flip: 0 144 | v_flip: 0 145 | } 146 | cell { 147 | x: 3 148 | y: 4 149 | tile: 3 150 | h_flip: 0 151 | v_flip: 0 152 | } 153 | cell { 154 | x: 0 155 | y: 5 156 | tile: 3 157 | h_flip: 0 158 | v_flip: 0 159 | } 160 | cell { 161 | x: 1 162 | y: 5 163 | tile: 3 164 | h_flip: 0 165 | v_flip: 0 166 | } 167 | cell { 168 | x: 2 169 | y: 5 170 | tile: 0 171 | h_flip: 0 172 | v_flip: 0 173 | } 174 | cell { 175 | x: 3 176 | y: 5 177 | tile: 3 178 | h_flip: 0 179 | v_flip: 0 180 | } 181 | cell { 182 | x: 4 183 | y: 5 184 | tile: 3 185 | h_flip: 0 186 | v_flip: 0 187 | } 188 | cell { 189 | x: 0 190 | y: 6 191 | tile: 4 192 | h_flip: 0 193 | v_flip: 0 194 | } 195 | cell { 196 | x: 1 197 | y: 6 198 | tile: 3 199 | h_flip: 0 200 | v_flip: 0 201 | } 202 | cell { 203 | x: 2 204 | y: 6 205 | tile: 3 206 | h_flip: 0 207 | v_flip: 0 208 | } 209 | cell { 210 | x: 3 211 | y: 6 212 | tile: 3 213 | h_flip: 0 214 | v_flip: 0 215 | } 216 | cell { 217 | x: 4 218 | y: 6 219 | tile: 4 220 | h_flip: 0 221 | v_flip: 0 222 | } 223 | cell { 224 | x: 0 225 | y: 7 226 | tile: 4 227 | h_flip: 0 228 | v_flip: 0 229 | } 230 | cell { 231 | x: 1 232 | y: 7 233 | tile: 4 234 | h_flip: 0 235 | v_flip: 0 236 | } 237 | cell { 238 | x: 2 239 | y: 7 240 | tile: 3 241 | h_flip: 0 242 | v_flip: 0 243 | } 244 | cell { 245 | x: 3 246 | y: 7 247 | tile: 4 248 | h_flip: 0 249 | v_flip: 0 250 | } 251 | cell { 252 | x: 4 253 | y: 7 254 | tile: 4 255 | h_flip: 0 256 | v_flip: 0 257 | } 258 | } 259 | layers { 260 | id: "setup" 261 | z: 0.0 262 | is_visible: 1 263 | cell { 264 | x: 0 265 | y: 0 266 | tile: 7 267 | h_flip: 0 268 | v_flip: 0 269 | } 270 | cell { 271 | x: 1 272 | y: 0 273 | tile: 7 274 | h_flip: 0 275 | v_flip: 0 276 | } 277 | cell { 278 | x: 2 279 | y: 0 280 | tile: 7 281 | h_flip: 0 282 | v_flip: 0 283 | } 284 | cell { 285 | x: 3 286 | y: 0 287 | tile: 8 288 | h_flip: 0 289 | v_flip: 0 290 | } 291 | cell { 292 | x: 4 293 | y: 0 294 | tile: 7 295 | h_flip: 0 296 | v_flip: 0 297 | } 298 | cell { 299 | x: 0 300 | y: 1 301 | tile: 11 302 | h_flip: 0 303 | v_flip: 0 304 | } 305 | cell { 306 | x: 1 307 | y: 1 308 | tile: 8 309 | h_flip: 0 310 | v_flip: 0 311 | } 312 | cell { 313 | x: 2 314 | y: 1 315 | tile: 7 316 | h_flip: 0 317 | v_flip: 0 318 | } 319 | cell { 320 | x: 3 321 | y: 1 322 | tile: 7 323 | h_flip: 0 324 | v_flip: 0 325 | } 326 | cell { 327 | x: 4 328 | y: 1 329 | tile: 7 330 | h_flip: 0 331 | v_flip: 0 332 | } 333 | cell { 334 | x: 0 335 | y: 2 336 | tile: 7 337 | h_flip: 0 338 | v_flip: 0 339 | } 340 | cell { 341 | x: 1 342 | y: 2 343 | tile: 9 344 | h_flip: 0 345 | v_flip: 0 346 | } 347 | cell { 348 | x: 2 349 | y: 2 350 | tile: 8 351 | h_flip: 0 352 | v_flip: 0 353 | } 354 | cell { 355 | x: 3 356 | y: 2 357 | tile: 10 358 | h_flip: 0 359 | v_flip: 0 360 | } 361 | cell { 362 | x: 4 363 | y: 2 364 | tile: 8 365 | h_flip: 0 366 | v_flip: 0 367 | } 368 | cell { 369 | x: 1 370 | y: 3 371 | tile: 9 372 | h_flip: 0 373 | v_flip: 0 374 | } 375 | cell { 376 | x: 2 377 | y: 3 378 | tile: 9 379 | h_flip: 0 380 | v_flip: 0 381 | } 382 | cell { 383 | x: 3 384 | y: 3 385 | tile: 9 386 | h_flip: 0 387 | v_flip: 0 388 | } 389 | cell { 390 | x: 1 391 | y: 4 392 | tile: 7 393 | h_flip: 0 394 | v_flip: 0 395 | } 396 | cell { 397 | x: 2 398 | y: 4 399 | tile: 8 400 | h_flip: 0 401 | v_flip: 0 402 | } 403 | cell { 404 | x: 3 405 | y: 4 406 | tile: 9 407 | h_flip: 0 408 | v_flip: 0 409 | } 410 | cell { 411 | x: 0 412 | y: 5 413 | tile: 9 414 | h_flip: 0 415 | v_flip: 0 416 | } 417 | cell { 418 | x: 1 419 | y: 5 420 | tile: 11 421 | h_flip: 0 422 | v_flip: 0 423 | } 424 | cell { 425 | x: 3 426 | y: 5 427 | tile: 10 428 | h_flip: 0 429 | v_flip: 0 430 | } 431 | cell { 432 | x: 4 433 | y: 5 434 | tile: 10 435 | h_flip: 0 436 | v_flip: 0 437 | } 438 | cell { 439 | x: 0 440 | y: 6 441 | tile: 9 442 | h_flip: 0 443 | v_flip: 0 444 | } 445 | cell { 446 | x: 1 447 | y: 6 448 | tile: 9 449 | h_flip: 0 450 | v_flip: 0 451 | } 452 | cell { 453 | x: 2 454 | y: 6 455 | tile: 9 456 | h_flip: 0 457 | v_flip: 0 458 | } 459 | cell { 460 | x: 3 461 | y: 6 462 | tile: 9 463 | h_flip: 0 464 | v_flip: 0 465 | } 466 | cell { 467 | x: 4 468 | y: 6 469 | tile: 9 470 | h_flip: 0 471 | v_flip: 0 472 | } 473 | cell { 474 | x: 0 475 | y: 7 476 | tile: 8 477 | h_flip: 0 478 | v_flip: 0 479 | } 480 | cell { 481 | x: 1 482 | y: 7 483 | tile: 10 484 | h_flip: 0 485 | v_flip: 0 486 | } 487 | cell { 488 | x: 2 489 | y: 7 490 | tile: 10 491 | h_flip: 0 492 | v_flip: 0 493 | } 494 | cell { 495 | x: 3 496 | y: 7 497 | tile: 9 498 | h_flip: 0 499 | v_flip: 0 500 | } 501 | cell { 502 | x: 4 503 | y: 7 504 | tile: 10 505 | h_flip: 0 506 | v_flip: 0 507 | } 508 | } 509 | material: "/builtins/materials/tile_map.material" 510 | blend_mode: BLEND_MODE_ALPHA 511 | -------------------------------------------------------------------------------- /main/main.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | collection_instances { 3 | id: "level" 4 | collection: "/main/level_2/level_2.collection" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | --------------------------------------------------------------------------------