I am trying to work on a Scratch project involving two characters, yet cannot find a way to make it so that when BOTH objects reach their goal, the background changes, not unlike Portal 2. I'm hoping a more experienced Scratch member can help me out. If you have ANY idea on how I can do this, please post. Thank you.

Offline
You could probably use an <and> statement to check if both sprites are at the goal, somewhat like this:
Goal Sprite:
When green flag clicked
forever if <touching p1 and touching p2>
broadcast [level change]Stage
When I receive [level change] next background
Hope that helps!
Offline
You could try:
Start
Forever If <touching[sprite1]> and <touching[sprite2]>
Broadcast [Change Background]
Sorry, I didn't see the above post while I was writing.
Last edited by laptop97 (2011-08-06 12:39:13)
Offline
With colors, it might be a bit trickier depending on how you want to do it. If you want the goal to be a distinct color instead of a sprite, you should have a script in each player sprite that sets a value (such as p1 touching) to 1 when touching that color and 0 when it's not.
Player sprites:
When green flag clicked
forever
if <touching color red>
set [p1 touching] to 1
else
set [p1 touching] to 0Then you'd want to modify the original script I showed you to look like this:
Stage:
When green flag clicked
forever
if <[p1 touching] = 1 and [p2 touching] = 1>
next backgroundOffline
Harakou wrote:
With colors, it might be a bit trickier depending on how you want to do it. If you want the goal to be a distinct color instead of a sprite, you should have a script in each player sprite that sets a value (such as p1 touching) to 1 when touching that color and 0 when it's not.
Player sprites:Code:
When green flag clicked forever if <touching color red> set [p1 touching] to 1 else set [p1 touching] to 0Then you'd want to modify the original script I showed you to look like this:
Stage:Code:
When green flag clicked forever if <[p1 touching] = 1 and [p2 touching] = 1> next background
You do know you dont need to use variables:
Player dosent need a script
Stage:
When green flag clicked
forever
if < <[p1colour] touching [goalcolour]> and <[p2colour] touching [goalcolour]>
next background
end if
end foreverLess scripts for each, but more complicated to put together.
Offline