Create Continuously Scrolling Tiled Backgrounds (Textures)

1

Index

Stats

14,274 visits, 27,373 views

Tools

Translations

This tutorial hasn't been translated.

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 25 May, 2012. Last updated 19 Feb, 2019

Scrolling in Four Directions

For this, we will use families. Creating the textures as before. The objects within the families will have variables assocaited with them, which will be used to control the speed an direction of the texture. For your game, you can then simple change the values of these variables to effect the scrolling of the texture.

Tutorial

- As before create the Tiled Background objects

- Create a family group

- Add the following variables (size, layer, down, right)

.

.

Size: Related to the size of the texture (256x256, 512x512 etc..)

Layer: Refers to the layer the texture will be placed on to keep the correct ordering.

Down: The rate at which the texture scrolls down (or up with a negative).

Right: The rate at which the texture scrolls right(or left with a negative).

.

- Open up the events editor.

- Enter the code below

Note: I named the family 'scrolling'.

.

.

Explaination: The hotspot is at the top left of the textures. The width and height of the textures are they same, labled as 'size'. The textures begin at point (-256, -256) or (-size, -size). When the texture cross the Y or X=0 lines or the Y or X=-256 (-size) lines, the textures position resets. Each tick the texture moves along the X axis by the 'right' value, and Y axis by the 'down' value. Since the textures start off-screen and their size is set larger than the layout their edges should never be seen. Their 'layer' declares which layer they.

  • 0 Comments

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