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

#1 2010-11-05 02:23:21

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Creating New Hat Blocks??? - Need Jens/NX111's answer

Hi does anyone know how to create new hat blocks

specifically a when sprite created block

thanks

Offline

 

#2 2010-11-05 05:01:37

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

easiest way?
make your 'create sprite' block broadcast 'scratch-spritecreated'!

hard way?
ask nXIII!

Offline

 

#3 2010-11-05 07:27:31

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

LS97 wrote:

easiest way?
make your 'create sprite' block broadcast 'scratch-spritecreated'!

hard way?
ask nXIII!

so i make my clone block brodcast something.

But how do i make a hat block

Thanks

Offline

 

#4 2010-11-05 07:38:04

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

hat blocks are generally created under Scratch-Blocks -> nameOfHatBlock.

but to make it easy for yourself you could simply modify the 'when i receive' hat block to take clonecreated broadcasts!

Offline

 

#5 2010-11-05 15:41:08

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

LS97 wrote:

easiest way?
make your 'create sprite' block broadcast 'scratch-spritecreated'!

hard way?
ask nXIII!

Wait...isn't that the hard way?  tongue
I think I just made it a little syntactically nicer by making a HatBlockMorph subclass. You can just copy-paste most of the code from the green-flag-hat class (I forget what it's called)

Last edited by nXIII (2010-11-05 15:41:26)


nXIII

Offline

 

#6 2010-11-05 19:09:17

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

nXIII wrote:

LS97 wrote:

easiest way?
make your 'create sprite' block broadcast 'scratch-spritecreated'!

hard way?
ask nXIII!

Wait...isn't that the hard way?  tongue
I think I just made it a little syntactically nicer by making a HatBlockMorph subclass. You can just copy-paste most of the code from the green-flag-hat class (I forget what it's called)

so i find the green hat class and copy it over and change it slightly

Offline

 

#7 2010-11-05 19:45:47

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

ok so i used LS97's method and made it brodcast it but how do i only broadcast it to a new clone

Offline

 

#8 2010-11-06 05:31:56

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

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

In the title, you typed NX111, not nXIII


/* No comment */

Offline

 

#9 2010-11-06 05:40:12

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

me450 wrote:

ok so i used LS97's method and made it brodcast it but how do i only broadcast it to a new clone

well, then you'll have to do one of these two things:

- make a eventhatblockmorph's subclass and make that test whether that sprite is a clone or not

- use nXIII's <i am a clone> block with the broadcast (look for it in the forums)

Offline

 

#10 2010-11-06 15:02:02

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

LS97 wrote:

me450 wrote:

ok so i used LS97's method and made it brodcast it but how do i only broadcast it to a new clone

well, then you'll have to do one of these two things:

- make a eventhatblockmorph's subclass and make that test whether that sprite is a clone or not

- use nXIII's <i am a clone> block with the broadcast (look for it in the forums)

I think what he/she means is how they would broadcast the message to the clone when it is created. In this case, I would use the (is it eventReceived:?) method to send an event to just the newly created clone.


nXIII

Offline

 

#11 2010-11-06 16:24:27

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

nXIII wrote:

LS97 wrote:

me450 wrote:

ok so i used LS97's method and made it brodcast it but how do i only broadcast it to a new clone

well, then you'll have to do one of these two things:

- make a eventhatblockmorph's subclass and make that test whether that sprite is a clone or not

- use nXIII's <i am a clone> block with the broadcast (look for it in the forums)

I think what he/she means is how they would broadcast the message to the clone when it is created. In this case, I would use the (is it eventReceived:?) method to send an event to just the newly created clone.

oh -- ok nvm my suggestion sorry. i'll read posts better in the future

Offline

 

#12 2010-11-06 22:32:02

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Creating New Hat Blocks??? - Need Jens/NX111's answer

ok
so NXIII

how did you make your when sprite created hat block

Thanks

Offline

 

Board footer