• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Changing Background Sprite Frame? ( image_index)

A

Anomaly

Guest
Is changing background sprite frames an available option?
I've been trying different methods but nothing seems to be able to accomplish this.

does anyone know about this?
thanks!
 

Jakylgamer

Member
assuming this is for gms2
Code:
var lay_id = layer_get_id("Background"); 
var back_id = layer_background_get_id(lay_id); 
layer_background_index(back_id, 0); //set index to whatever you need it to be
layer_background_speed(back_id,0); //set animation speed to 0
 
A

Anomaly

Guest
assuming this is for gms2
Code:
var lay_id = layer_get_id("Background");
var back_id = layer_background_get_id(lay_id);
layer_background_index(back_id, 0); //set index to whatever you need it to be
layer_background_speed(back_id,0); //set animation speed to 0

oh man thank you so much .
i was close one time ... looking at my commented muted old tries.
!
 
assuming this is for gms2
Code:
var lay_id = layer_get_id("Background");
var back_id = layer_background_get_id(lay_id);
layer_background_index(back_id, 0); //set index to whatever you need it to be
layer_background_speed(back_id,0); //set animation speed to 0
Thanks, I used your code as well. Works like a charm. I used it to randomize background color each time a room starts.
 
Top