This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-10-13 01:13:15

Flumgug
Scratcher
Registered: 2007-10-13
Posts: 1

A few questions about backgrounds and sprites...

1.) How can I make it so when the main sprite gets to a certain area on the screen it switches to another background?

2.) How can I have different scripts for different things? For example, so I can use the left arrow key for different things, it just depends on what screen you're on.  Also, i can't figure out how to have a sprite on just one page, so they're there only on one screen.

3.) How can I create walls so my character can't go beyond a certain area on [some] of the screens?

Thanks in advance!

Offline

 

#2 2007-10-13 11:33:27

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: A few questions about backgrounds and sprites...

1) In the sprite:
    when <greenflag>
    wait until <touching color ___>    (or whatever your test for switching is)
    broadcast change_background and wait

  On the stage:
      when I receive change-background
         next background

2) There is no way to *detect* which background you are using (which is too bad---it has been suggested as an improvement to scratch).  Instead you have to have an all-sprites variable (say "level")

On the stage:
      when I receive change-background
             change level by 1
             set background to <level>

In the sprites you can test what level you are on to determine what a key does.

Last edited by kevin_karplus (2007-10-13 11:34:29)

Offline

 

#3 2007-10-13 11:35:46

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: A few questions about backgrounds and sprites...

For 3), look through the forum---that question has been asked and answered many times.

Perhaps the threads for it  should be bumped to the FAQ forum, if they haven't been already.

Offline

 

Board footer