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

#1 2011-07-24 12:16:57

Blooker
New Scratcher
Registered: 2011-03-05
Posts: 9

Problem detecting another Sprite's hidden or showing?

I want one sprite to detect another sprite is Hidden or Showing. Is there any way I can do this?

PS: I can't put an image because new scratchers can't place images in topics. Sorry!

Offline

 

#2 2011-07-24 12:19:15

owetre18
Scratcher
Registered: 2009-07-01
Posts: 1000+

Re: Problem detecting another Sprite's hidden or showing?

Let's see, you could use a new block (most likely, you don't know squeak, so scratch that)

Or you can use this script

[Blocks]
<hide>
<set{ hidden? }to( 1
[/blocks]

and

[blocks]
<show>
<set{ hidden? }to( 0
[/blocks]

When you want it to hide, you just use the first script, and when not hidden, use the second script.

Last edited by owetre18 (2011-07-24 12:20:37)

Offline

 

#3 2011-07-24 12:24:30

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Problem detecting another Sprite's hidden or showing?

owetre18 wrote:

Let's see, you could use a new block (most likely, you don't know squeak, so scratch that)

Or you can use this script

[blocks]
<hide>
<set{ hidden? }to( 1
[/blocks]

and

[blocks]
<show>
<set{ hidden? }to( 0
[/blocks]

When you want it to hide, you just use the first script, and when not hidden, use the second script.

Also, you want each sprite to have the "hidden?" variable, and make sure it's personal variablesmile

Offline

 

#4 2011-07-25 12:10:35

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: Problem detecting another Sprite's hidden or showing?

scimonster, it wouldnt work if its a personal variable. You need variables like hidden1, hidden2 and so on.


I'm back.
Maybe.

Offline

 

#5 2011-07-25 12:31:02

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Problem detecting another Sprite's hidden or showing?

DigiTechs wrote:

scimonster, it wouldnt work if its a personal variable. You need variables like hidden1, hidden2 and so on.

Not true.

You can read a sprite's personal variables using a sensing block:

([x position] of [Sprite1])

Under "x position", there is listed any private variables for that sprite.

Last edited by BoltBait (2011-07-25 12:33:07)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#6 2011-07-25 15:07:10

Blooker
New Scratcher
Registered: 2011-03-05
Posts: 9

Re: Problem detecting another Sprite's hidden or showing?

Another problem is that, When I want it to hide forever, It wont. I press the spacebar to close each menu like 'Help' or 'Credits', But when I press space during the game, the two buttons just flashes rapidly. Any help on how to stop this?

Offline

 

#7 2011-07-25 15:20:58

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Problem detecting another Sprite's hidden or showing?

Blooker wrote:

Another problem is that, When I want it to hide forever, It wont. I press the spacebar to close each menu like 'Help' or 'Credits', But when I press space during the game, the two buttons just flashes rapidly. Any help on how to stop this?

It sounds like you need another variable that indicates that your game is running (perhaps you already have one).  In the script that the space key runs (or the script that checks for space key pressed), you'd add

If "GameRunning = 0" then
do costume stuff

If the GameRunning variable is "1", the costume changes wouldn't happen. 

I usually use a boolean like this to enable "forever if" scripts.  This makes it easy to stop a script under certain conditions by just changing a varible.

Offline

 

#8 2011-07-28 15:41:04

Blooker
New Scratcher
Registered: 2011-03-05
Posts: 9

Re: Problem detecting another Sprite's hidden or showing?

I've posted it here: http://scratch.mit.edu/forums/viewtopic.php?id=69580
Go ahead and download it, I figured I'd need some help anyway.

Offline

 

#9 2011-07-28 16:15:08

Blooker
New Scratcher
Registered: 2011-03-05
Posts: 9

Re: Problem detecting another Sprite's hidden or showing?

I've posted it here: http://scratch.mit.edu/projects/Blooker/1948956
Go ahead and download it, I figured I'd need some help anyway.

Offline

 

#10 2011-07-28 17:51:34

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Problem detecting another Sprite's hidden or showing?

Fixed

Hope that helps ^^

Offline

 

#11 2011-07-29 06:04:19

Blooker
New Scratcher
Registered: 2011-03-05
Posts: 9

Re: Problem detecting another Sprite's hidden or showing?

deatheater wrote:

Fixed

Hope that helps ^^

Thank you!!!  big_smile

Offline

 

#12 2011-07-29 12:26:19

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: Problem detecting another Sprite's hidden or showing?

BoltBait wrote:

DigiTechs wrote:

scimonster, it wouldnt work if its a personal variable. You need variables like hidden1, hidden2 and so on.

Not true.

You can read a sprite's personal variables using a sensing block:

([x position] of [Sprite1])

Under "x position", there is listed any private variables for that sprite.

O: never known that.


I'm back.
Maybe.

Offline

 

#13 2011-09-15 15:12:56

Blooker
New Scratcher
Registered: 2011-03-05
Posts: 9

Re: Problem detecting another Sprite's hidden or showing?

DigiTechs wrote:

BoltBait wrote:

DigiTechs wrote:

scimonster, it wouldnt work if its a personal variable. You need variables like hidden1, hidden2 and so on.

Not true.

You can read a sprite's personal variables using a sensing block:

([x position] of [Sprite1])

Under "x position", there is listed any private variables for that sprite.

O: never known that.

Me neither, thanks for the tip

Offline

 

Board footer