change background

Get help using Construct 2

Post » Tue Feb 05, 2013 9:58 pm

Hello again, the question is if I can to guide to learn the best way to change the frame or background by pressing a button.

thanks
B
6
Posts: 40
Reputation: 1,005

Post » Tue Feb 05, 2013 11:18 pm

Depends on how many backgrounds you need. If you only need 2 then you can use an "instance variable" and set the type to "boolean"

Set a key to "toggle" the "boolean".
When "true" set background 1 to "visible" and background 2 to "invisible"
When "false" set background 1 to "invisible" and background 2 to "visible"Semo2013-02-05 23:19:52
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Wed Feb 06, 2013 10:20 am

ok thanks. I think I need 4 or 5, the question is why.
B
6
Posts: 40
Reputation: 1,005

Post » Wed Feb 06, 2013 10:26 am

Use number variable and place all backgrounds in same sprite under separate animation frames (assuming background does not need animating).

Then do something like this:

on button pressed
.. set background to animation frame Variable
.. Add 1 to Variable
.. if Variable > number of backgrounds
... variable = 0
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Wed Feb 06, 2013 11:12 am

thanks, i go to do.

Im sorry for my inglish but I am spanish
B
6
Posts: 40
Reputation: 1,005


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests