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

#1 2007-06-03 23:01:15

Robobob
Scratcher
Registered: 2007-06-03
Posts: 7

How To swich screen

How do you make It swich screen 2 when you touch the side of screen 1. But if on Screen 3 to not go to sceen 2???

Last edited by Robobob (2007-06-04 16:11:17)

Offline

 

#2 2007-06-04 02:08:23

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: How To swich screen

Set a variable "SpriteX"
Inside a forever loop on the sprite, have "set spritex=x"

On the stage:
Inside a forever (or repeat until) loop
If spritex > 240, switch to costume "second scene"


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-06-04 10:02:06

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

Re: How To swich screen

It would be better to use a broadcast and have the sprite detect the edge itself

in sprite
  when green flag
  wait until x-position > 230
  broadcast switch to level 2 and wait


on stage
   when I receive switch to level 2
        switch to costume "second scene"

Offline

 

#4 2007-06-04 12:00:39

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: How To swich screen

I tend to be leery of broadcasts - they seem to be one of the things that occasionally fouls up when you upload your demo.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#5 2007-06-04 16:13:40

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

Re: How To swich screen

Actually, foerver loops are more likely to foul up the Java implementation than broadcasts are, and broadcast and wait is safer still.

Offline

 

Board footer