I'm currently in the middle of creating a game with a bird's-eye-view. Basically, you'll be looking down on the main character and his adventures throughout. What I'm having a problem with is that I have many backgrounds(rooms) to enter and I can't use the scripts with
"if touching color _"
"change to background _"
With all the different backgrounds(rooms) I have planned for this project, I'd eventually run out of colors, not to mention the colors I've already used to paint the backgrounds themselves. I need a script that will allow me to go the edge of the background screen, whether it be the top, left, right, or bottom edge and once I reach that edge to go the appropriate screen that I have broadcasted for it.
For example,
"if touching left edge of background 1"
"change to backround 2"
Do I need to make a variable for this?
Any help would be greatly appreciated.
Offline
Lists are a good approach here...I've got an example that uses lists to keep track of what the neighbor backgrounds are for the four possible directions...
http://scratch.mit.edu/projects/Paddle2SeeFixIt/832535
Offline
If i'm doing stuff like this I normally use sensors. Just make it as long as the little door is and name it as it's room. For example if I wanted to make a room sensor for the town hall, then I would call it "town hall sensor".
Then put on the sensor
When green flag clicked
Forever
set ghost effect to 100
--
And then on your little mover, do exaclty your code except do
If touching sprite : Sensor
than
If touching colour.
Offline
climber59 wrote:
You can use
<if> <(<x position> <>> 235 )>
That would probably be too complicated. You'd have to figure out the x position then put it in. It is a way though.
Offline