• 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!

Use player File for room background

I

igorcarlier

Guest
Hello Everyone , loving the studio so far , still doing baby steps. I want to ask players to upload a image that will be used as background for the room. what am I doing wrong ?
The room opens but the image does not apply as background.

var back = layer_background_get_id(room0);
faceplate = get_open_filename("image file|*.png", "");
sprite8 = sprite_add(faceplate,1,true,true,0,0);
layer_background_change(back,sprite8);
 
H

Homunculus

Guest
layer_background_get_id requires a layer id, not a room id (since a room can have more than one background, you have to be specific here). The manual entry for this function provides exactly the code you require as an example (minus the code to load the sprite, but that part looks ok to me).
I also just read in the docs that layer_background_change is deprecated in favor of layer_background_sprite.
 
Top