Individual background tiling

  • 18 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.capx

tiling-sprites.capx

Download now 82.44 KB

Stats

2,299 visits, 5,750 views

Tools

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

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