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
Last edited by GP1 (2012-02-08 22:00:46)
Offline
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:
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:
do %n something %s or something %b
MORE COMMING SOON!
Last edited by GP1 (2012-02-08 21:58:15)
Offline
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 BLOCKblocks.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 %bMORE COMMING SOON!
Wait a minute
new block ( 'block-type','category','blockspec','action',[default]);
what ?!!!!!!!!!!!!!!!!!!!!!
Why not
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)
Offline
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.
Offline
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
Offline