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

#1 2012-02-08 21:19:45

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

morphic.js tutorials and known extensions

I just found out about morphic.js, and more people should use it (in my opinion) but the problem is: its too confusing. This thread will have tutorials, known extensions and known applications. I will even teach you how to mod Snap! pre-alpha.

Tutorials
Modding Snap!


Known extensions
none


Known applications
none

Please contribute  big_smile 

Last edited by GP1 (2012-02-08 22:00:46)


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

#2 2012-02-08 21:25:54

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: morphic.js tutorials and known extensions

Modding Snap!
Yes, you can mod snap! pre-alpha. In my spare time, I'm messing around with the source. Now it is time to release the secret and make better mods!
First, we need the source code. Download it here. In it, you will find a file named objects.js. This is our workspace.

Objects.js is where blocks are defined, however blocks.js creates the block shape, but not the actual block. Looking through objects.js, find this code:

Code:

if (cat === 'motion') {

There are other codes like this in the script. This is where you put motion blocks. Other "if"s define different catagories.

To add a block, you out this code (in your catagory that you want)
QUOTES ARE NEEDED WHEN MAKING A BLOCK

blocks.push(block(
'block type',
'catagory',
'blockspec',
'action',
[default]
)
);

The defat value is optional, but you need to alo take out the [] and the , right before it.
The blockspec is the same as its always been (in squeak) however you do not add the actiln or default value in the spec. An example spec to put there is:

Code:

do %n something %s or something %b

MORE COMMING SOON!

Last edited by GP1 (2012-02-08 21:58:15)


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

#3 2012-02-09 10:34:01

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: morphic.js tutorials and known extensions

GP1 wrote:

Modding Snap!
Yes, you can mod snap! pre-alpha. In my spare time, I'm messing around with the source. Now it is time to release the secret and make better mods!
First, we need the source code. Download it here. In it, you will find a file named objects.js. This is our workspace.

Objects.js is where blocks are defined, however blocks.js creates the block shape, but not the actual block. Looking through objects.js, find this code:

Code:

if (cat === 'motion') {

There are other codes like this in the script. This is where you put motion blocks. Other "if"s define different catagories.

To add a block, you out this code (in your catagory that you want)
QUOTES ARE NEEDED WHEN MAKING A BLOCK

blocks.push(block(
'block type',
'catagory',
'blockspec',
'action',
[default]
)
);

The defat value is optional, but you need to alo take out the [] and the , right before it.
The blockspec is the same as its always been (in squeak) however you do not add the actiln or default value in the spec. An example spec to put there is:

Code:

do %n something %s or something %b

MORE COMMING SOON!

Wait a minute

Code:

new block ( 'block-type','category','blockspec','action',[default]);

what ?!!!!!!!!!!!!!!!!!!!!!

Why not

Code:

new block({
   type:'xyz',
   category:'dada',
   spec:'dedado',
   action:function(){
   },
   someotherobject:'value'
});

@Jens ?? why ????? the first case ??

Last edited by fanofcena (2012-02-09 10:41:20)


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#4 2012-02-09 15:19:53

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: morphic.js tutorials and known extensions

fanofcena wrote:

Why not

Code:

new block({
   type:'xyz',
   category:'dada',
   spec:'dedado',
   action:function(){
   },
   someotherobject:'value'
});

Well, that does seem better, however I think that Jens had a reason for what he did.


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

#5 2012-02-10 11:17:33

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: morphic.js tutorials and known extensions

GP1 wrote:

fanofcena wrote:

Why not

Code:

new block({
   type:'xyz',
   category:'dada',
   spec:'dedado',
   action:function(){
   },
   someotherobject:'value'
});

Well, that does seem better, however I think that Jens had a reason for what he did.

I dont find any reason [maybe just me] because in most of the libraries or even in Vanilla we use the { } to pass object properties as much as possible because of the unavailabilty of polymorphism in JS. its much more flexible and much more JSISH


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

Board footer