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

#1 2011-02-27 19:43:44

kluspossible
Scratcher
Registered: 2009-04-15
Posts: 34

Adding a skip buton

I currently working on a project that has an intro (Timed changes in backrounds and sprites showing and dissapearing) and then the acual game. I wanted to add a skip button for those who dont want to rewatch the intro whenever they play the game. I'm not really sure what a good scrip for this would be. I was trying a few things but it didnt work out.

Offline

 

#2 2011-02-27 20:11:18

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

Re: Adding a skip buton

Make the button come at the beginning so the user has a choice whether to skip or not. Then make a variable "skip" yes or no. If skip is no, then the sprites do the intros. If skip is yes, it skips directly to the game. Hope this helps!

Offline

 

#3 2011-02-27 20:13:27

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Adding a skip buton

First make your intro start by means of broadcast (have a message called "Intro" which starts all the intro things [if it starts immediately have a "When Green Flag Clicked broadcast Intro".])

Next put an if over all of the intro's scripts like "if Skip? = 0" (Make a variable called Skip?)
(Set Skip? to 0 at the start of the project)

Next, your skip button should say When Skip Button Pressed Set Skip? to 1, then broadcast intro again.  Now because Skip? is equal to 1 and not 0 it will skip all of the introduction sequences and move right into the game.


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#4 2011-02-28 19:55:46

kluspossible
Scratcher
Registered: 2009-04-15
Posts: 34

Re: Adding a skip buton

Kileymeister wrote:

First make your intro start by means of broadcast (have a message called "Intro" which starts all the intro things [if it starts immediately have a "When Green Flag Clicked broadcast Intro".])

Next put an if over all of the intro's scripts like "if Skip? = 0" (Make a variable called Skip?)
(Set Skip? to 0 at the start of the project)

Next, your skip button should say When Skip Button Pressed Set Skip? to 1, then broadcast intro again.  Now because Skip? is equal to 1 and not 0 it will skip all of the introduction sequences and move right into the game.

Thanks for the help! I makes sense and everthing but for some reason it's not working. I think I made my scripting much more complicated than its suposed to be.

Like an example of one of my scripts is:

[blocks]
<when green flag clicked>
<set{script} to( 0
<broadcast[intro
<if>
<(script<=>0)>
<repeat( 10
<switch to background[ 1
<switch to bacground[ 2
<wait( 1 )secsc>
<switch to backgound[ 3
<broadcast[ first year
<wait( 2
<switch to background[ 4
<wait ( 4 )secsc>
<broadcast[ 2nd year
[/blocks]

Then the brodcasts would affect orther sprites and other scriptings.

Offline

 

Board footer