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

#926 2010-11-27 14:18:00

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

JQuery??


You can now reach me on Twitter @johnnydean1_

Offline

 

#927 2010-11-27 14:32:38

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

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

JQuery??

Have you heard of Google?


/* No comment */

Offline

 

#928 2010-11-27 14:42:24

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

I have but use it rarely


You can now reach me on Twitter @johnnydean1_

Offline

 

#929 2010-11-27 15:02:39

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

midnightleopard wrote:

I don't think jquery is needed. If we wanted to make an HTML element glide across a web page then yes, but we are working in a canvas so no. All in favor of not using jquery say I. [blocks]<say[ I ]>[/blocks]

Seeing as what midnight leopard said was probably true, somone is going to need to redo the  motionblocks before I learn canvas!

Ill race you!


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#930 2010-11-27 18:11:24

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

Wait: Aren't we drawing every sprite to a seperate canvas? that would mean we wouldnt need to rewrite code, and transforms() would be a pain to code  with many sprites anyway...

Alternatively, we could use PHP to create an image/png  and just use an img tag to embed it...


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#931 2010-11-27 18:23:53

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: Lets make a new Scratch viewer!

Um, JD1, you might want to update the topic post, as it links to the old site, and there's outdated info in the post.


Yawn.

Offline

 

#932 2010-11-28 04:16:04

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

I've got it! We use separate canvas tags (Mozilla style) like so

Code:

<canvas id="sprite1" style="position: absolute; top: 100px; left: 30px; z-index: 1">
</canvas>
<canvas id="stage" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index:-1">
</canvas>

And then, we put image tags on the inside of those for the people that don't have canvas:

Code:

<canvas id="sprite1" style="position: absolute; top: 100px; left: 30px; z-index: 1">
<img src="<?php imagefunctioncall() ?>" style="position: absolute; top: 100px; left: 30px; z-index: 1" />
</canvas>

So, the canvas allows more flexibility and more stuff to be done, but in the end it CAN all boil down to an img tag if necessary

Note: Safari will display both the <canvas> and the <img> some CSS tricks should get rid of that!


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#933 2010-11-28 05:11:19

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

Yes, like the idea of getting PHP to make the image!  big_smile
PHP could get the GIF image and then save that in a temp folder.  smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#934 2010-11-28 05:45:04

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

So, are we going to use the canvas tag at all... without would certainly be more compatible...

and JD1 did say he wanted to use as  little HTML5 as possible...


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#935 2010-11-28 07:46:28

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

Re: Lets make a new Scratch viewer!

markyparky56 wrote:

johnnydean1 wrote:

markyparky56 wrote:

I've been wanting to ask this for a while, its likely already been asked though.
Whats wrong with the current one?

Nothing, except try viewing it on the Wii, DS or your phone. It doesnt work see. This one should work!

I don't have a Wii or a DS, with internet; or a phone to view it with! Thats what a computer is for, and a computer views it fine!

I have a Wii with internet!

BTW, what is the block.js for? And also, I would like to have a job please! I know HTML, CSS, HTML5(learning), and I am learning Javascript!

Offline

 

#936 2010-11-28 07:48:29

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

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

johnnydean1 wrote:

TheSuccessor wrote:


That's a bad idea as it will interrupt the execution of all other scripts.

Ok then have a toggle box that toggles a pop up keyboard.

look here: http://www.scratchhtmlviewer.net23.net/keys.html
my keyboard I made!  big_smile

Nice!!!

Offline

 

#937 2010-11-28 10:22:54

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Lets clear things up
Language
I would like it to be in any combo of

PHP
JavaScript
HTML4

This will allow compatability with most (95%) of web browsers.

Jobs
Heres what we still need

A way to get the scripts
A way to get the costumes
A way of displaying the costumes
A way of running scripts

Updates
When I have time I will update the first post


You can now reach me on Twitter @johnnydean1_

Offline

 

#938 2010-11-28 10:59:15

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

Re: Lets make a new Scratch viewer!

I'm working on the way of running scripts. It's nearly finished.


/* No comment */

Offline

 

#939 2010-11-28 12:39:28

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

scratch.fridgecow.com/block.js  is my compilation of every Scratch block we have  redone in javascript.

I suggest someone gives me ftp acces to the website so I can upload it straight to there.


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#940 2010-11-28 17:08:06

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Lets make a new Scratch viewer!

more sensing code:
(I'm using tcb's element inside as well)

Code:

//distance from sprite %value1
function getDistance(element, value1) {
otherSprite = getElementByID(value1)
x1 = element.style.left
x2 = otherSprite.style.left
y1 = element.style.top
y2 = otherSprite.style.left
c1 = x1 - x2
c2 = y1 - y2
d1 = c1 - x1 //(correct the math if i screwed up, it made point C and is calculating the
d2 = c2 - y1 //distance.)

return (Math.sqrt(d1*d1)+(d2*d2))  } //Changed it to find the distance between the two.

Curiously, how would I do the mouses?

Last edited by bbbeb (2010-11-29 23:28:18)


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#941 2010-11-29 01:51:53

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

OK, I'm adding that to block.js...

Wait...

Your code is finding the distance from element...
Remember, value1 is the id of the element...
We need to find the distance between element and value1....
And theres not even a single getElementById!

So, the maths is right, but I don't think the output will be as excpected....
Sorry  sad


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#942 2010-11-29 07:21:35

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Lets make a new Scratch viewer!

tcb wrote:

OK, I'm adding that to block.js...

Wait...

Your code is finding the distance from element...
Remember, value1 is the id of the element...
We need to find the distance between element and value1....
And theres not even a single getElementById!

So, the maths is right, but I don't think the output will be as excpected....
Sorry  sad

My bad, I rushed through it.

I THINK i fixed it....

Last edited by bbbeb (2010-11-29 07:30:07)


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#943 2010-11-29 16:31:01

paulpsicle
Scratcher
Registered: 2008-10-12
Posts: 100+

Re: Lets make a new Scratch viewer!

I have written a lot of scratch blocks in javascript. get them here. I did some panther, too. It also includes a new sprite function. The block functions are (arg1, arg2, element). The element argument is actually the element, not the id.

Last edited by paulpsicle (2010-11-29 16:50:32)


http://blocks.scratchr.org/API.php?user=paulpsicle&amp;action=onlineStatus&amp;online=http://fishery.dyndns.org/paulpsicle.png&amp;offline=http://fishery.dyndns.org/paulpsicle_o.png

Offline

 

#944 2010-11-29 16:42:52

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Suggestion

Do we add as many blocks from mod's as possible, to get a big range of support?


You can now reach me on Twitter @johnnydean1_

Offline

 

#945 2010-11-29 23:20:54

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

Suggestion

Do we add as many blocks from mod's as possible, to get a big range of support?

Yeah! Then we have to completely recode everything to accomadate Panther, BYOB, Bingo...

Maybe a bit much. Just the ones like [open url %s] and the universal mod blocks.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#946 2010-11-30 02:38:02

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

bbbeb wrote:

johnnydean1 wrote:

Suggestion

Do we add as many blocks from mod's as possible, to get a big range of support?

Yeah! Then we have to completely recode everything to accomadate Panther, BYOB, Bingo...

Maybe a bit much. Just the ones like [open url %s] and the universal mod blocks.

only do this for mods that allows us to view the source. That leaves out BYOB and many others. We have to do this becuase we need to get the spec, code ect from it and that means we need access.  tongue
Anyway BYOB header has changed.  sad


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#947 2010-11-30 03:20:59

tcb
Scratcher
Registered: 2008-03-25
Posts: 100+

Re: Lets make a new Scratch viewer!

paulpsicle wrote:

I have written a lot of scratch blocks in javascript. get them here. I did some panther, too. It also includes a new sprite function. The block functions are (arg1, arg2, element). The element argument is actually the element, not the id.

Nice... Cool code. I'm jealous  sad . But... you seem to be switching in-between the sprites canvas being the same as the stages canvas, as in line 8:

Code:

this.canvas = document.getElementById("stagecanvas").getContext('2d'

and it being a seperate element:

Code:

function glideSecsToXY(t1, t2, t3, e){
    var x = e.style.left;
    var y = e.style.top;
    $("#" + e).animate({
        left: xpos + t2 + "px",
        top: ypos + t3 + "px"
        }, t1);
    var canvas = sprites[e.id].canvas;
    if(sprites[e.id].pendown){
    canvas.moveTo(x, y);
    canvas.lineTo(e.style.left, e.style.top);
    canvas.stroke();
    }
}

Wait! I get it! sprites[obj.id].canvas is the canvas for the pendown blocks, not for the sprite itself to be drawn on.

And style.webkitTransform only works with webkit browsers. This is slightly more cross-browser:

Code:

    $("#" + sID).css({ '-moz-transform': sCSS, '-o-transform': sCSS, '-webkit-transform': sCSS });

Sorry to be nitpicky, but I was confused by the awesome code...

Last edited by tcb (2010-11-30 03:27:15)


http://goo.gl/eCQLihttp://goo.gl/sK54shttp://goo.gl/jC0dehttp://goo.gl/yhGLQhttp://goo.gl/wqvsQ

Offline

 

#948 2010-11-30 09:04:00

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

bbbeb wrote:

johnnydean1 wrote:

Suggestion

Do we add as many blocks from mod's as possible, to get a big range of support?

Yeah! Then we have to completely recode everything to accomadate Panther, BYOB, Bingo...

Maybe a bit much. Just the ones like [open url %s] and the universal mod blocks.

only do this for mods that allows us to view the source. That leaves out BYOB and many others. We have to do this becuase we need to get the spec, code ect from it and that means we need access.  tongue
Anyway BYOB header has changed.  sad

DUDE! BYOB is open source, and the rest are hackable! The header change in BYOB isn't hard to change either. BUUUUUUUUUUTTTTTTTTT, lets stick with Scratch for now.  tongue


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#949 2010-11-30 11:56:41

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Ok lets do the normal scratch blocks +
open url %s
get url %s
read line %n from %s
write %s to file %s (writes as a cookie)
read file %s
%n ^ %n


and if we do mesh
join mesh %s
leave mesh %s
host mesh
(ip adress)

That way we should be about 50% conpatible with most mods


You can now reach me on Twitter @johnnydean1_

Offline

 

#950 2010-11-30 12:14:26

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

Ok lets do the normal scratch blocks +
open url %s
get url %s
read line %n from %s (from cookie)
write %s to file %s (writes as a cookie)
read file %s (from cookie)
%n ^ %n


and if we do mesh
join mesh %s
leave mesh %s
host mesh
(ip adress)

That way we should be about 50% conpatible with most mods


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

Board footer