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

#1 2010-10-01 11:55:12

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Overriden sensing block.

I expect you know the ([property] of [sprite]) block.
Property contains stuff like x position, y position, etc. and the sprite only variables of that sprite.
However, if you create a sprite-only variable that has the same name as one of those properties, it overrides it.
For example, if you create a sprite-only variable named 'x position', and try to detect the actual x position of that sprite, you'll get the sprite-only variable instead of the value you want.

(To people who know the source code: I know why it does this. It was by looking at the source code that I found this. Please don't explain it to me.)


/* No comment */

Offline

 

#2 2010-10-01 14:00:09

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Overriden sensing block.

Interesting "feature"!  My advice, if you don't want that behavior - don't name the variables like that  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2010-10-01 14:25:39

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Overriden sensing block.

I found this before. Basicly its beacause of this.
direction of sprite1

The block takes the first input as a String then looks through variables. If it exists it reports that variable. If no variable is found it gets the propites of the sprite


You can now reach me on Twitter @johnnydean1_

Offline

 

#4 2010-10-11 15:27:22

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Overriden sensing block.

johnnydean1 wrote:

I found this before. Basicly its beacause of this.
direction of sprite1

The block takes the first input as a String then looks through variables. If it exists it reports that variable. If no variable is found it gets the propites of the sprite

I wrote:

(To people who know the source code: I know why it does this. It was by looking at the source code that I found this. Please don't explain it to me.)


/* No comment */

Offline

 

Board footer