Advanced section
Automatic tile adapation
Let's say you want to spread the tiles along your layout width. Construct 2 can do the calculation for you!
You can take the Layout's width and height and divide them by the WoodSprite's width and height.
Download the .capx file and change it accordingly like this:
Create a single-colored sprite, give it the behaviors
- 8Direction
- ScrollTo
- BoundToLayout
and move this sprite to the bounds of the layout. Awesome, autotiling works perfectly! :-)
Add randomness
Now the wooden tiles could be turned randomly in 180°. The following has to be considered:
1. Set the origin from 0, 0 to the tile center 10, 50
--> the tiling is now offset to the left and top
2. Correct the formulae in the loops by adding +10 and +50
3. Add a following event in the loops
WoodSprite -> Set angle to int(random(2)[]180 degrees*