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

#1 2012-10-10 18:28:56

Vonologic
New Scratcher
Registered: 2012-10-10
Posts: 4

Selection Screen

Hi Scratchers,
My script is basically a video game called "Revenge of the Nerds," where you dodge a football player and get more points depending on how long you survive. However, I recently decided to add a character selection screen allowing you to choose different "nerds" instead of being limited to the one default sprite. I also added a start screen. Basically, there is a sprite that says "Click anywhere to play," and when the stage is clicked, the game proceeds to the character selection screen. However, i am unsure how to make my characters appear on the character selection screen. Is there a code block that says "When ____, show?" (In this case the blank being when the stage is clicked. I know there is a "When Stage Clicked" block, but it is impossible to put that onto scripts for sprites, I am only able to use it on script for the stage itself. If I duplicate that block onto a sprite's script, then it automatically changes to "When SpriteX is clicked" Is there anyway to make these characters appear after I click the stage and proceed to the loading screen?

Offline

 

#2 2012-10-10 18:49:22

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Selection Screen

No matter where you click, you'll be clicking on the screen, so you could use:

when gf clicked
hide
wait until <not <mouse down?>>
wait until <mouse down?>
show
stage selection script
I hope that this helps!


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2012-10-10 18:55:51

Vonologic
New Scratcher
Registered: 2012-10-10
Posts: 4

Re: Selection Screen

ErnieParke wrote:

No matter where you click, you'll be clicking on the screen, so you could use:

when gf clicked
hide
wait until <not <mouse down?>>
wait until <mouse down?>
show
stage selection script
I hope that this helps!

Thanks a lot Ernie, that got them to appear.  smile  So now, when a sprite gets clicked, do I have to copy all of my code from the default "Nerd" onto that sprite in order for it to work? Or is there a shortcut that lets that one code suffice for all of the sprites, depending on which is chosen? There's no way for me to click on one sprite, and something happens for another...or is there? (If that were the case, I would simply go to my default sprite and put "If <insert sprite here> is clicked, switch to costumex." Is this possible?

Offline

 

#4 2012-10-10 20:20:12

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Selection Screen

Yes, this is possible using variables, or you could use several operators, though the variable method is simpler. Just tell me if you want to see it the other way.

Anyway, use this script in the sprite that you click:

set [costume v] to (1)
repeat until (done?)
 if <(touching [mouse-pointer v]?) and (mouse down?)>
  change [costume v] by (1)
  wait until <not (mouse down?)>
 end
end
And then use this in the sprite that's supposed to change costumes:

repeat until (done?)
 switch to costume (costume)
end

Last edited by ErnieParke (2012-10-10 20:20:46)


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2012-10-10 21:41:10

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Selection Screen

Imagine that each different nerd option has a number assigned to him.  In your main "nerd" sprite (which should contain all your gameplay scripts), make a costume for each nerd.  Using the "select nerd" screen, set the value of a variable (let's call it "NerdType") to the number associated with the appropriate nerd.  Then, in the sprite, include this block inside one of your forever loops:

switch to costume (NerdType)

Last edited by amcerbu (2012-10-10 21:41:41)

Offline

 

#6 2012-10-10 22:00:50

Vonologic
New Scratcher
Registered: 2012-10-10
Posts: 4

Re: Selection Screen

ErnieParke wrote:

Yes, this is possible using variables, or you could use several operators, though the variable method is simpler. Just tell me if you want to see it the other way.

Anyway, use this script in the sprite that you click:

set [costume v] to (1)
repeat until (done?)
 if <(touching [mouse-pointer v]?) and (mouse down?)>
  change [costume v] by (1)
  wait until <not (mouse down?)>
 end
end
And then use this in the sprite that's supposed to change costumes:

repeat until (done?)
 switch to costume (costume)
end

What exactly is the "done" block?

Offline

 

#7 2012-10-10 22:05:35

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Selection Screen

Vonologic wrote:

ErnieParke wrote:

Yes, this is possible using variables, or you could use several operators, though the variable method is simpler. Just tell me if you want to see it the other way.

Anyway, use this script in the sprite that you click:

set [costume v] to (1)
repeat until (done?)
 if <(touching [mouse-pointer v]?) and (mouse down?)>
  change [costume v] by (1)
  wait until <not (mouse down?)>
 end
end
And then use this in the sprite that's supposed to change costumes:

repeat until (done?)
 switch to costume (costume)
end

What exactly is the "done" block?

The "done" block is whatever you use to determine when you're done selecting a costume.

Last edited by ErnieParke (2012-10-10 22:09:17)


http://i46.tinypic.com/35ismmc.png

Offline

 

#8 2012-10-10 22:09:02

Vonologic
New Scratcher
Registered: 2012-10-10
Posts: 4

Re: Selection Screen

Oh, ok. Well I reuploaded my game, and I decided to make "done" be if NerdType (or costume) is greater than 0. Now I just need to make the other costumes hide, and the stage change after the NerdType had changed. I think I know how to make the other sprites hide, but how exactly do I make the background change after the nerdtype is changed? I would really appreciate it if someone downloaded the code and viewed it via Scratch, as it's a bit sloppy  hmm

Offline

 

Board footer