Individual background tiling

2

Index

Attached Files

The following files have been attached to this tutorial:

.capx

tiling-sprites.capx

Download now 82.44 KB

Stats

5,086 visits, 10,186 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 11 Oct, 2013. Last updated 19 Feb, 2019

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*

.CAPX

tiling-sprites.capx

Download now 82.44 KB
  • 0 Comments

Want to leave a comment? Login or Register an account!