#5 2011-03-16 15:57:03

YourLocalBlockLib
Scratcher
Registered: 2011-03-10
Posts: 100+

Re: ITopic: Welcome to your local block library!

Looks
/img/tinypic/1555368.jpg

/img/dropbox/BlockLibDiv2.png

/img/weebly/4051214.gif
Shared by Jwosty
blockspec:

('say nothing' #- #sayNothing)

no code needed

/img/dropbox/BlockLibDiv2.png

/img/weebly/659197290.gif
Shared by sonicjosh
blockspec:

('paint new costume' #- #drawNewCostume)

no code needed

What it does:
Opens the paint editor and lets you paint a new sprite. Good for games where people want to choose their own avatars.

/img/dropbox/BlockLibDiv2.png

/img/weebly/265193936.gif
Shared by coupdegrace
blockspec:

('go forward %n layers' #- #goFwdByLayers: 1)

Code:

goFwdByLayers: t1
    owner ifNil: [^ self].
    self layer: (owner submorphs indexOf: self)
            - t1 truncated

What it does:
Moves your sprite forward the specified amount of layers. Note: this can also be achieved by typing a negative number into the go back %n layers block

/img/dropbox/BlockLibDiv2.png

/img/weebly/559334414.gif
Shared by Pecola1
Click here for the 6 stage panning blocks.
What these blocks do:
Pan the stage background around.

/img/dropbox/BlockLibDiv2.png

/img/imgur/SvimA.gif
Shared by Jens Mönig
blockspec:

('h flip' #- #hFlip)

Code:

hFlip
    costume form: (self form flipBy: #horizontal centerAt: 0 @ 0).
    self costumeChanged

What this block does:
Flips a sprite horizontally to give a mirror image costume.

/img/dropbox/BlockLibDiv2.png

/img/imgur/Bib6g.gif Shared by owetre18, based on the above block
Blockspec:

('v flip' #- #vFlip)

Code:

vFlip
    costume form: (self form flipBy: #vertical centerAt: 0 @ 0).
    self costumeChanged

What this block does:
Flips a sprite vertically to give a mirror image costume.

/img/dropbox/BlockLibDiv2.png

/img/weebly/173417862.gif
Shared by Pecola1
blockspec:

('grab screen region for new sprite' #- #grabSpriteFromScreen)

Code:
no code needed
What it does:
Lets you grab a region of the screen to make a new sprite with.

/img/dropbox/BlockLibDiv2.png

/img/weebly/173417862.gif
Shared by Pecola1
blockspec:

('save picture of stage' #- #stageShot)

Code:
no code needed
What it does:
Lets you save a picture of the stage.

/img/dropbox/BlockLibDiv2.png

/img/weebly/351923669.gif
Shared by Pecola1
blockspec:

('grab a new costume from stage' #- #grabFromScreen)

Code:
no code needed
What it does:
Lets you grab a region of the screen to make a new costume.

/img/dropbox/BlockLibDiv2.png

/img/weebly/676693851.gif
Shared by Pecola1
blockspec:

('layer #' #r #layer)

Code:

layer
    ^ owner submorphs indexOf: self

What it does:
Reports the layer number of the sprite.

/img/dropbox/BlockLibDiv2.png

/img/weebly/802890144.gif
Shared by Pecola1
blockspec:

('go to layer %n' #- #layer:)

Code:
no code needed
What it does:
Moves the sprite to a new layer.

/img/dropbox/BlockLibDiv2.png

/img/weebly/363118739.gif
Shared by Pecola1
blockspec:

('name of costume # %n' #r #costumeNameFromNumber:)

Code:
no code needed
What it does:
Reports the name of the costume number.

/img/dropbox/BlockLibDiv2.png

/img/weebly/8854022.gif
Shared by Scratchycat123
blockspec:

('hidden?' #b #isHidden)

Code:
no code needed

/img/dropbox/BlockLibDiv2.png

/img/weebly/1133536.gif
Shared by Hardmath123
blockspec:

('Jump forward %n costumes' #- #nextCostume: 2)

Code:

nextCostume: t1
    self costumeIndex: self costumeIndex + t1

/img/dropbox/BlockLibDiv2.png

/img/weebly/9925713.gif
Shared by jslomba and made with Scramble
blockspec:

('animate costumes %n to %n with %n seconds in between %n times' #- #Anmat:Anmat:Anmat:Anmat:)

Code:

Anmat: i1 Anmat: i2 Anmat: i3 Anmat: i4
| t1 |
i4
timesRepeat:
[self lookLike: 1 + self costumeIndex.
t1 _ self costumeIndex.
t1 = i2 ifTrue: [self lookLike: i1].
(Delay forSeconds: i3) wait]

/img/dropbox/BlockLibDiv2.png

/img/weebly/7833808.gif Shared by Hardmath123 and made with Scramble, improved by Greenatic   (This block may also be used with backgrounds.)
Blockspec:

('Number of costumes' #r #numOfCos)

Code:

numOfCos
"Made using Scramble by Hardmath123"
| t1 |
    t1 _ 0.
    media do: [:t2 | t2 isImage ifTrue: [t1 _ t1 + 1]].
    ^ t1

/img/dropbox/BlockLibDiv2.png

/img/weebly/9999914.gif Shared by Hardmath123 and made with Scramble
Blockspec:

('Switch whether hidden or shown' #- #switchHide)

Code:

switchHide
"Made using Scramble by Hardmath123"
| t1|
t1 _ self isHidden.
t1 ifTrue: [
self show.
].
t1 ifFalse: [
self hide.
].

/img/dropbox/BlockLibDiv2.png

/img/weebly/2847219.gif Shared by Hardmath123
Blockspec:

('Get the name of costume number %n ' #r #costumeNameFromNumber: 1)

Code:
no code needed

/img/dropbox/BlockLibDiv2.png

/img/weebly/7316521.gif Shared by Hardmath123 and made with Scramble
Blockspec:

('Am I on %l ?' #b #onCostume:)

Code:

onCostume: i1
"Made using Scramble by Hardmath123"
| t2 t1|

t1 _ self costumeIndex.
t2 _ self costumeNameFromNumber:t1.
t2 = i1 ifTrue: [
^ true
].
t2 = i1 ifFalse: [
^ false
]

/img/dropbox/BlockLibDiv2.png

/img/polyeztahpuppies/height.gif Shared by Baderous
Blockspec:

('height' #r #height)

Code:
no code needed
What this block does:
Reports the height of the sprite.

/img/dropbox/BlockLibDiv2.png

/img/polyeztahpuppies/width.gif Shared by Baderous
Blockspec:

('width' #r #width)

Code:
no code needed
What this block does:
Reports the width of the sprite.

/img/dropbox/BlockLibDiv2.png

/img/weebly/1427275.gif Shared by TuragaTreeko
Blockspec:

('area' #r #area)

Code:

area
^self height * self width

What this block does:
Reports the amount of pixels the sprite takes up.

/img/dropbox/BlockLibDiv2.png

/img/weebly/1923913.gif Shared by Greenatic
Blockspec:

('perimeter' #r #perimeter)

Code:

perimeter
^ (2 * self height) + (2 * self width)

What this block does:
Reports the perimeter of the sprite.

/img/dropbox/BlockLibDiv2.png

^ Back to Scratch Blocks
^ Back to Contents
 

Last edited by YourLocalBlockLib (2011-12-17 14:49:08)


/img/dropbox/BlockLibraryTitle.png

Offline