How do I on every start of game the background change !!!!

Get help using Construct 2

Post » Fri May 30, 2014 11:26 am

hi,
i just want to do this
on every start of game (every start of first layout) the back ground change (but stil same in other layout and dont change)

for exemple i have 3 background

welcome layout , play layout , end layout

on every start of welcome layout the background change and keep it on other layout
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Fri May 30, 2014 3:30 pm

any help please ?
thanks in advance
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Fri May 30, 2014 3:44 pm

That all depends on if you want the game to randomly choose the image each time, or if you want it to choose the background in a specific order.

If you want to make sure it specifically cycles through each background in a specific order you will need to store the last bg used in a variable on the computer and update it each time the game runs. If you do this, you would have an event on start of layout to load the information and select the next bg in the sequence.

If you just want a random background (and this is the easier solution) you would just need to create your background objects, and use the random(N) function to decide which to use.

In both scenarios, you would use a global variable contained in an event sheet, which all scenes had access to, to store the background you have currently selected. You would set this variable on the first scene and and all the other scenes would just reference it to properly set their bg.
B
39
S
12
G
11
Posts: 331
Reputation: 7,727

Post » Fri May 30, 2014 3:49 pm

Are you using 1 sprite for all background, or 3 sprites?

If you are using 3 - you should merge them all into one (using different frames for the same animation).

And now - just change the animation frame when game starts/ends.
B
5
Posts: 24
Reputation: 280

Post » Fri May 30, 2014 9:56 pm

i would like that change randomly

@erez
good idea about animation ;)

but i dont know how to set it !!!! :(
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Fri May 30, 2014 10:24 pm

Check this
demo.capx
You do not have the required permissions to view the files attached to this post.
B
11
S
3
Posts: 39
Reputation: 814


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, evillair, gamecorpstudio, jorgmaquoi, ultrafop and 24 guests