Variable that determines the horizontal scrolling speed for a background.



Returns: Real


By setting this variable array to a different value, you can set the speed at which GameMaker: Studio automatically scrolls a background for you along the horizontal plane. A positive value will scroll from left to right, while a negative value will be right to left and 0 stops all scrolling. if you have also enabled horizontal tiling, either through the room editor or by using the background_htiled variable, then scrolling the background will make it loop infinitely.


if background_htiled[0]
   background_hspeed[0] = 2;

The above code checks background0 to see if it is tiled horizontally, and if it is it then sets the horizontal scroll speed to 2.

Back: Backgrounds
Next: background_vspeed
© Copyright YoYo Games Ltd. 2018 All Rights Reserved