Change Background and have an hspeed[solved]

W

Wild_West

Guest
I can't seem to get this to work, I'm trying to make a really simple block matching game, and I want the bg to change every time the game's level increases.
But I tried using draw_background combined with background_hspeed and that didn't work.
I tried room_set_background and still nothing. How do I do this?

switch(global.block_game_level)
{
case 2 : room_set_background(nature_block_game_room,0,true,false,sky_bg_2,0,0,true,false,-6,0,1); break;
case 3 : room_set_background(nature_block_game_room,0,true,false,sky_bg_3,0,0,true,false,-6,0,1); break;
case 4 : room_set_background(nature_block_game_room,0,true,false,sky_bg_4,0,0,true,false,-6,0,1); break;
case 5 : room_set_background(nature_block_game_room,0,true,false,sky_bg_5,0,0,true,false,-6,0,1); break;
}
 
D

DarthTenebris

Guest
https://docs.yoyogames.com/source/dadiospice/002_reference/rooms/room_set_background.html
"With this function you can set a background for a room (except the current one), with all the same property options that you can find in the room editor like horizontal speed and horizontal or vertical tiling."

Im pretty sure you can use these variables to change the current background:
http://docs.yoyogames.com/source/dadiospice/002_reference/game assets/backgrounds/
Welp I've been beaten in speed... o_O
 
W

Wild_West

Guest
https://docs.yoyogames.com/source/dadiospice/002_reference/rooms/room_set_background.html
"With this function you can set a background for a room (except the current one), with all the same property options that you can find in the room editor like horizontal speed and horizontal or vertical tiling."

Im pretty sure you can use these variables to change the current background:
http://docs.yoyogames.com/source/dadiospice/002_reference/game assets/backgrounds/
Oh I must've missed that part of the manual xD
So what should I do just change rooms for each level?
 
W

Wild_West

Guest
Try this instead:
Code:
switch(global.block_game_level)
{
case 2: draw_background_stretched(sky_bg_2,0,0,room_width,room_height);
case 3: draw_background_stretched(sky_bg_3,0,0,room_width,room_height);
case 3: ... and so on...
}
From what I read:

https://docs.yoyogames.com/source/dadiospice/002_reference/rooms/room_set_background.html
I tried draw_background already as I said in my first post. It did draw the background with each new level but I couldn't get it to scroll using background_hspeed
 
D

DarthTenebris

Guest
Oh I must've missed that part of the manual xD
So what should I do just change rooms for each level?
I would've made multiple rooms for multiple levels. But I wouldn't change backgrounds every time I level up... I would just use draw_text() to display the current level.
Haven't tried anything myself, just making guesses, but here:
Code:
switch(global.block_game_level)
{
case 2: background_index[0] = sky_bg_2;
case 3: background_index[0] = sky_bg_3;
etc...
}
Trying to freshen my mind, I am working on a game myself, and I have a problem with the logic of drawing text properly :/
 
W

Wild_West

Guest
I would've made multiple rooms for multiple levels. But I wouldn't change backgrounds every time I level up... I would just use draw_text() to display the current level.
Haven't tried anything myself, just making guesses, but here:
Code:
switch(global.block_game_level)
{
case 2: background_index[0] = sky_bg_2;
case 3: background_index[0] = sky_bg_3;
etc...
}
Trying to freshen my mind, I am working on a game myself, and I have a problem with the logic of drawing text properly :/
Yeah I mean that's what I assume most would do with a level change but this game as well as the platformer I'm almost done with are both based off a fictional world I designed where the sky color changes monthly as a representation of the 6 guardian deities that govern the world. So I thought a cool way to represent that in game would be to use the level up after getting enough points. Sort of a world promotion thing to keep the themes consistent since in the platformer game there's 6 levels per stage and each one uses one of the 6 sky backgrounds too as you progress.
But that's beside the point. I'll try the index method.
 
W

Wild_West

Guest
I would've made multiple rooms for multiple levels. But I wouldn't change backgrounds every time I level up... I would just use draw_text() to display the current level.
Haven't tried anything myself, just making guesses, but here:
Code:
switch(global.block_game_level)
{
case 2: background_index[0] = sky_bg_2;
case 3: background_index[0] = sky_bg_3;
etc...
}
Trying to freshen my mind, I am working on a game myself, and I have a problem with the logic of drawing text properly :/
It worked ^ Thanks man good call
 
Top