Help with Background Sprites, tile and scale.

Zekidan

Member
Hey im new to game maker and I am wondering if there is a simple way to both horizontally tile a sprite while also being able to adjust the image_yscale of the same sprite in a background layer, in the step event?

I want the sprite to tile horizontally so that it is indefinite, however i want it to scale vertically based on the camera’s zoom creating a 3d effect.

however the problem is I'm having a hard time finding a function to scale the background sprite in game.

Perhaps I should use an object instead?
 

curato

Member
that really depends on the sprite. The more your want to stretch or wrap it, the more simple you are going to want the sprit to be. A high detail sprite will most likely look bad all stretched.
 

Zekidan

Member
that really depends on the sprite. The more your want to stretch or wrap it, the more simple you are going to want the sprit to be. A high detail sprite will most likely look bad all stretched.
I didnt ask how it would look, or advice on how to make things look good. I asked can it be done, and how to do it? No where did i ask will this look good? I know how it will look. Thank you
 

chamaeleon

Member
After selecting horizontal tiling for a background, a helper object to do something every step
Create event
GML:
counter = 0;
Step event
GML:
var layer_id = layer_get_id("Background");
var background_id = layer_background_get_id(layer_id);
layer_background_yscale(background_id, (2+dsin(counter)));
counter++;
As the sprite is not tiled vertically, you might need a second background layer under the scaling one to help clear the view every step (or you get remnants from the scaling layer when it is smaller than the previous step).
 

Zekidan

Member
After selecting horizontal tiling for a background, a helper object to do something every step
Create event
GML:
counter = 0;
Step event
GML:
var layer_id = layer_get_id("Background");
var background_id = layer_background_get_id(layer_id);
layer_background_yscale(background_id, (2+dsin(counter)));
counter++;
As the sprite is not tiled vertically, you might need a second background layer under the scaling one to help clear the view every step (or you get remnants from the scaling layer when it is smaller than the previous step).
Thank you definitely will try it!!
 
Top