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

#1 2011-08-14 15:47:25

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

scratch_blox.js — the ultimate JavaScript library

http://scratchloveit.netne.net/topicrate.php?id=71787&ret=image&style=2
chat about it
http://myfastcounter.com/count.php?c_style=15&id=1313382295 views!!

I thought of this a long time ago, but never got around to it.
scratch_blox.js is a JavaScript library to help make games in JavaScript. It uses functions that have block names and you call them to make things do stuff.
Example:

Code:

$(document).ready(function(){
!forever{
show("#pic");
waitSeconds(5);
hide("#pic");
waitSeconds(5);
}
});

In this example, the script shows the pic, waits 5 seconds, hides the pic, waits 5seconds, then repeats it forever.
This is a simple way for people who understand scratch to create JavaScript games.

I need developers and testers. Ask me and I'll put you in the box.

GP1 — head developer http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text
ProgrammingFreak — developer http://blocks.scratchr.org/API.php?user=ProgrammingFreak&action=onlineStatus&type=text
WindowsExplorer — tester http://blocks.scratchr.org/API.php?user=WindowsExplorer&action=onlineStatus&type=text
Guinea_Pig_Girl — tester http://blocks.scratchr.org/API.php?user=Guinea_Pig_Girl&action=onlineStatus&type=text
gbear605 — developer http://blocks.scratchr.org/API.php?user=gbear605&action=onlineStatus&type=text
bobbybee — developer http://blocks.scratchr.org/API.php?user=bobbybee&action=onlineStatus&type=text
ohaiderstudios — tester http://blocks.scratchr.org/API.php?user=ohaiderstudios&action=onlineStatus&type=text

Downloads: unavailable: not debugged properly, so we're starting over.  sad

Last edited by GP1 (2011-08-26 17:46:01)


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 2011-08-14 16:16:03

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

Cool idea! I always wanted to jearn JavaScript! Whens it going to be out?


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#3 2011-08-14 16:17:31

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

Re: scratch_blox.js — the ultimate JavaScript library

I don't know. I don't even have another developer  sad  I'm guessing that you want to be a tester?


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

 

#4 2011-08-14 16:24:37

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

Ya ya!  tongue


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#5 2011-08-14 16:29:34

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

Re: scratch_blox.js — the ultimate JavaScript library

UPDATE: 3 blocks:
show()
hide()
forever(){}


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

 

#6 2011-08-14 16:49:53

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

Oh wow. I have wanted to do this forever, but no one seemed to be interested in helping!  big_smile  I will help but first you need to look at these articles.  wink  They are helpful.

http://www.admixweb.com/2009/05/20/how- … rk-part-1/
http://blogs.vertigo.com/personal/rbigg … .aspx?ID=8

Offline

 

#7 2011-08-14 17:01:10

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

Re: scratch_blox.js — the ultimate JavaScript library

ProgrammingFreak wrote:

Oh wow. I have wanted to do this forever, but no one seemed to be interested in helping!  big_smile  I will help but first you need to look at these articles.  wink  They are helpful.

http://www.admixweb.com/2009/05/20/how- … rk-part-1/
http://blogs.vertigo.com/personal/rbigg … .aspx?ID=8

Thanks, I'll look at them and put you in the box. Lol, I wanted to do this so that I could make games with js easy smeasy


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

 

#8 2011-08-14 17:08:25

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

In your example, you are using some jQuery code.  tongue

Offline

 

#9 2011-08-14 17:09:36

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

Re: scratch_blox.js — the ultimate JavaScript library

BTW, pf, could you go to the chat, plz? There we can share code and discuss development


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

 

#10 2011-08-14 17:58:45

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

okay  big_smile

Offline

 

#11 2011-08-14 21:06:33

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

Re: scratch_blox.js — the ultimate JavaScript library

@pf those are really helpful. I need help with a block, more info in the chat room.


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

 

#12 2011-08-14 22:09:12

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

Re: scratch_blox.js — the ultimate JavaScript library

UPDATE: 2 new blocks
math (the *+/- blocks)
join()


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

 

#13 2011-08-15 11:13:17

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

GP1 wrote:

@pf those are really helpful. I need help with a block, more info in the chat room.

Okay. When are you normally on?

Offline

 

#14 2011-08-15 11:27:43

veggieman001
Scratcher
Registered: 2010-02-20
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

Wow! That looks like an amazing idea!  big_smile


Posts: 20000 - Show all posts

Offline

 

#15 2011-08-15 12:08:07

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

veggieman001 wrote:

Wow! That looks like an amazing idea!  big_smile

It really is.  big_smile

Offline

 

#16 2011-08-15 13:41:16

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

Re: scratch_blox.js — the ultimate JavaScript library

YAY!! I just got done with a lot of new blocks
I'm done with numbers and looks and control
And now I am done with sensing for version 1

Last edited by GP1 (2011-08-15 13:54:07)


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

 

#17 2011-08-15 14:34:48

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

Re: scratch_blox.js — the ultimate JavaScript library

We are now ready for testing. Sorry, pf, I kinda took over. Could you find out how to play sounds in js?
Anyway, I will edit the first post with directions.


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

 

#18 2011-08-15 14:58:30

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

Re: scratch_blox.js — the ultimate JavaScript library

These are the list of control blocks and what version they are in, along with the funciton.
[blocks]<when green flag clicked> not supported
____________________________________________________________________________________
<when[  ]key pressed> v1
$(document).keydown(funciton(){
//select to wich key here
if(keyDownBool('key here') ){
//code for game here
}
});
___________________________________________________________________________________
<wait(  )secsc> v1
waitSecondsThen(numberOfSeconds, function(){
//code to execute after num of seconds go by
});
___________________________________________________________________________________
<when[  ]clicked> v1
$("#idOfImageHere").click(function(){
//code when id is clicked
});
___________________________________________________________________________________
<forever> v1
forever(function(){
//code to repeat forever
});
___________________________________________________________________________________
<repeat( )> v1
repeat(numberOfTimesToRepeat, function(){
//code to be repeated the # of times
});
___________________________________________________________________________________
<broadcast[ ]> v1 as function
ex.
function nameOfFuntion(){
//code when called
//code won't be executed until you call the funtion
}
//anywhere in code
nameOfFunction();
__________________________________________________________________________________
<broadcast[  ]and wait c> not supported
__________________________________________________________________________________
<when I receive[ ]> as function
__________________________________________________________________________________
<forever if> v1
foreverIf(someSortOfBooleanAnswer, function(){
//code here
});
__________________________________________________________________________________
<if> v1
if(statement here){
//code here
}
__________________________________________________________________________________
<if><else> v1
if(statement here){
//code
}else{
//code
}
_________________________________________________________________________________
<wait until> not supported
_________________________________________________________________________________
<repeat until> v1
repeatUntil(booleanStatment, function(){
//code here
});
_________________________________________________________________________________
<stop script>not supported
_________________________________________________________________________________
<stop all> v1
exit;
_________________________________________________________________________________

Last edited by GP1 (2011-08-15 15:00:25)


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

Offline

 

#19 2011-08-15 15:30:31

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

Re: scratch_blox.js — the ultimate JavaScript library

These are the list of motion blocks and what version they are in, along with the function.
[blocks]<turn cw(  )degrees> v1
turnRight(idOfPicture, numberOfDegrees);
___________________________________________________________________________________
<turn cw(  )degrees> v1
turnLeft("#idOfPicture", numberOfDegrees);
___________________________________________________________________________________
<go to x sad   )y sad  )> v1
goTo("#idOfPicture", xPosition, yPosition);
___________________________________________________________________________________
<move(  )steps> not supported
___________________________________________________________________________________
<if on edge, bounce> not supported
___________________________________________________________________________________
<glide(  )secs to x sad   )y sad   )> not supported
___________________________________________________________________________________
<point in direction(  )> not supported
___________________________________________________________________________________
<change x by(  )> not supported
___________________________________________________________________________________
<point towards(  )> not supported
___________________________________________________________________________________
<direction> not supported
___________________________________________________________________________________
<x position> v1
xpos("#idOfPicture");
___________________________________________________________________________________
<y position> v1
ypos("#idOfPicture");
___________________________________________________________________________________
<change y by(  )> not supported
___________________________________________________________________________________
<set x to(  )> v1
setXpos("#idOfPicture", numberOfXPosition);
___________________________________________________________________________________
<set y to(  )> v1
setYpos("#idOfPicture", numberOfYPosition);
___________________________________________________________________________________
<go to[ anotherImage ]> v1
goToOther("#idOfImageGoing", "#idOfOtherImage");
___________________________________________________________________________________
<go to[ mouse ]> v1
goToMouse("#idOfImage");
___________________________________________________________________________________


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

Offline

 

#20 2011-08-15 16:04:41

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

Re: scratch_blox.js — the ultimate JavaScript library

it doesn't work at the moment, I'll try to fix this


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

Offline

 

#21 2011-08-15 16:19:27

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

Re: scratch_blox.js — the ultimate JavaScript library

@pragrammingfreak could you look the code over? Something is wrong and the code won't execute.
http://kitcatprogramming.net78.net/test … ch_blox.js
EDIT: I named the file scratch_blocks.js instead of scratch_blox.js LOL
I'm going to fix that.....

Last edited by GP1 (2011-08-15 16:20:39)


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

Offline

 

#22 2011-08-15 16:29:12

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

GP1 wrote:

@pragrammingfreak could you look the code over? Something is wrong and the code won't execute.
http://kitcatprogramming.net78.net/test … ch_blox.js
EDIT: I named the file scratch_blocks.js instead of scratch_blox.js LOL
I'm going to fix that.....

I'll see what I can do!  big_smile

Offline

 

#23 2011-08-15 16:31:50

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: scratch_blox.js — the ultimate JavaScript library

When is the last time it worked? That could help me narrow it down.  tongue  Uh, also, are we gonna have it look like scratch or just a textarea? or you use the source plain?

Offline

 

#24 2011-08-15 16:35:25

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

Re: scratch_blox.js — the ultimate JavaScript library

ProgrammingFreak wrote:

When is the last time it worked? That could help me narrow it down.  tongue  Uh, also, are we gonna have it look like scratch or just a textarea? or you use the source plain?

one version like scramble, another is plain source. Also, I never got the chance to try it out until I finished it


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

Offline

 

#25 2011-08-15 18:44:26

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

Re: scratch_blox.js — the ultimate JavaScript library

I guess I'd better start debugging it.


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

Offline

 

Board footer