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

#51 2012-05-20 00:55:21

ubrecma
Scratcher
Registered: 2012-05-12
Posts: 2

Re: Simplicity: Scratch in Processing

veggieman001 wrote:

Thanks for your interest! I've been working on this for a few months now, and glad to see people like you give comments about it.  smile

1. I will do that. I just directly copy and pasted code on here without really modifying it too much for that.
2. There is a built in string concatenation function, but I'm trying to make this as easy for beginners as possible so I'm using the function name from Scratch. It would also be difficult for someone starting out to have two different functions, + and Join(), for the different datatypes, string and Variable.
3. loc = 0
4. I personally think, based on the current casting Scratch has, that this is how it would be done if it were possible in Scratch.
5. You may have transparent pixels but I haven't finished doing the collision for such images.

Sorry for being unclear; when I looked at the implementation of the Join() function, it looked a bit clunky (it created a two-element array and joined that together). 

The collisions between two oddly-shaped sprites might be a little messy.  I guess you can rule out collisions between objects that are more than a certain distance apart, but making code for checking each pixel of one with each pixel of another won't be fun.

Offline

 

#52 2012-05-20 00:57:05

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Simplicity: Scratch in Processing

^ Whoops, accidentally posted with my test account.

Last edited by amcerbu (2012-05-20 00:57:40)

Offline

 

#53 2012-05-20 01:08:49

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

Re: Simplicity: Scratch in Processing

ubrecma wrote:

veggieman001 wrote:

Thanks for your interest! I've been working on this for a few months now, and glad to see people like you give comments about it.  smile

1. I will do that. I just directly copy and pasted code on here without really modifying it too much for that.
2. There is a built in string concatenation function, but I'm trying to make this as easy for beginners as possible so I'm using the function name from Scratch. It would also be difficult for someone starting out to have two different functions, + and Join(), for the different datatypes, string and Variable.
3. loc = 0
4. I personally think, based on the current casting Scratch has, that this is how it would be done if it were possible in Scratch.
5. You may have transparent pixels but I haven't finished doing the collision for such images.

Sorry for being unclear; when I looked at the implementation of the Join() function, it looked a bit clunky (it created a two-element array and joined that together). 

The collisions between two oddly-shaped sprites might be a little messy.  I guess you can rule out collisions between objects that are more than a certain distance apart, but making code for checking each pixel of one with each pixel of another won't be fun.

Haha that's weird, must have done that a while ago when I was first starting to understand things. I'll clean that up on Monday.

And yeah, it's not going to be fun. It'll take a while to figure out something that won't be slow.


Posts: 20000 - Show all posts

Offline

 

#54 2012-05-20 09:25:42

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Simplicity: Scratch in Processing

Remember to add cloud variables, cloning and the motion sensor!

Offline

 

#55 2012-05-20 10:03:14

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

Re: Simplicity: Scratch in Processing

ImagineIt wrote:

Remember to add cloud variables, cloning and the motion sensor!

:L
There will likely be cloning in a future version but neither cloud variables or a motion sensor are currently planned based on needing web space to do that I don't want to program/host and being way to hard to program, respectively.

If some genius comes in here and offers to do them, fine, but I just can't do those.


Posts: 20000 - Show all posts

Offline

 

#56 2012-05-20 13:17:49

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Simplicity: Scratch in Processing

Cloning wouldn't be too hard.  You just need dynamic memory allocation (I assume Processing has it if you can use the "new" operator).  But cloud variables and motion sensing are a lot harder.  You'd need some sort of server to store cloud variables (that memory could add up very quickly) and motion sensing is just ridiculously hard.

Offline

 

#57 2012-05-20 13:22:14

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

Re: Simplicity: Scratch in Processing

Yeah, I'm going to implement cloning, but it's not on my immediate list of thingamadoodles


Posts: 20000 - Show all posts

Offline

 

#58 2012-05-21 11:44:31

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

Re: Simplicity: Scratch in Processing

I've been reaaaaaallly inactive. Sorry. D:

Offline

 

#59 2012-05-26 22:06:21

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

Re: Simplicity: Scratch in Processing

I've started working on documentation and casting


Posts: 20000 - Show all posts

Offline

 

#60 2012-05-31 11:30:29

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

Re: Simplicity: Scratch in Processing

I've started trying to test compiling it, although I'm not done with all the functions. It's having the most issues with Minim  hmm


Posts: 20000 - Show all posts

Offline

 

#61 2012-06-06 02:18:08

slinger
Scratcher
Registered: 2011-06-21
Posts: 1000+

Re: Simplicity: Scratch in Processing

Bump  smile


http://s0.bcbits.com/img/buttons/bandcamp_130x27_blue.png

Offline

 

#62 2012-06-06 08:49:18

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

Re: Simplicity: Scratch in Processing

slinger wrote:

Awesome! I'll see if I can get my brother to code as he sorta knows processing  tongue

Who might your brother be?


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

Offline

 

#63 2012-06-06 09:13:07

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

Re: Simplicity: Scratch in Processing

slinger wrote:

Bump  smile

Haha, thanks.

I'm still having issues with sound in Java, and I've tried two different libraries so it's not the library. It has something to do with the getID3Tags() function of the libraries, apparently.


Posts: 20000 - Show all posts

Offline

 

#64 2012-06-12 17:57:17

scratchisthebest
Scratcher
Registered: 2009-02-08
Posts: 500+

Re: Simplicity: Scratch in Processing

veggieman001 wrote:

ImagineIt wrote:

Remember to add cloud variables, cloning and the motion sensor!

:L
There will likely be cloning in a future version but neither cloud variables or a motion sensor are currently planned based on needing web space to do that I don't want to program/host and being way to hard to program, respectively.

If some genius comes in here and offers to do them, fine, but I just can't do those.

Speaking.  tongue

I'll try the motion sensor when I have time. It'll have to use gsvideo instead of the default processing.video, because I somehow can't get .video working.  hmm

If .video is a must, you can swap over pretty quick. Just change the import, drop the GS from things and remove cam.play().

also, can you add me on gcode for documentation? I couldn't find out how to shout at you on code, but I tried gplus. You're "Fiberglass Monkey", right?

Last edited by scratchisthebest (2012-06-12 17:58:44)


bye 1.4, we all loved you. but we all outgrew the site. 2.0 is a welcome change.
http://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.png

Offline

 

#65 2012-06-12 18:43:05

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

Re: Simplicity: Scratch in Processing

scratchisthebest wrote:

veggieman001 wrote:

ImagineIt wrote:

Remember to add cloud variables, cloning and the motion sensor!

:L
There will likely be cloning in a future version but neither cloud variables or a motion sensor are currently planned based on needing web space to do that I don't want to program/host and being way to hard to program, respectively.

If some genius comes in here and offers to do them, fine, but I just can't do those.

Speaking.  tongue

I'll try the motion sensor when I have time. It'll have to use gsvideo instead of the default processing.video, because I somehow can't get .video working.  hmm

If .video is a must, you can swap over pretty quick. Just change the import, drop the GS from things and remove cam.play().

also, can you add me on gcode for documentation? I couldn't find out how to shout at you on code, but I tried gplus. You're "Fiberglass Monkey", right?

Heyo! Thanks for being interested.
GSVideo would actually probably be better, considering that it'll be the main library in Processing 2.0 and it uses an open framework.

And I got the message and will add you.  smile
When you're making changes, put them in Simplicity.pde in the trunk of the source. I'll put them in Java when I have time.


Posts: 20000 - Show all posts

Offline

 

#66 2012-06-14 09:54:30

scratchisthebest
Scratcher
Registered: 2009-02-08
Posts: 500+

Re: Simplicity: Scratch in Processing

veggieman001 wrote:

Heyo! Thanks for being interested.
GSVideo would actually probably be better, considering that it'll be the main library in Processing 2.0 and it uses an open framework.

And I got the message and will add you.  smile
When you're making changes, put them in Simplicity.pde in the trunk of the source. I'll put them in Java when I have time.

yayay!
thanks.

I'm trying to figure out svn to get/set the source, but is there an easier way?
edit: nvm, got it.

Last edited by scratchisthebest (2012-06-14 10:53:43)


bye 1.4, we all loved you. but we all outgrew the site. 2.0 is a welcome change.
http://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.png

Offline

 

#67 2012-06-14 10:55:30

scratchisthebest
Scratcher
Registered: 2009-02-08
Posts: 500+

Re: Simplicity: Scratch in Processing

I haven't pushed changes because
a) I don't know how and
b) I hit a processing bug.

costume.pde:

Code:

public class Costume {
  public PImage img, cmask;
  public int wids, heis;
  Costume (String cIm) {
    img = loadImage(cIm);
    wids = img.width;
    heis = img.height;
    cmask = createImage(img.width, img.height, RGB);
    cmask.loadPixels();
    img.loadPixels();
    for (int i = 0; i < img.pixels.length; i++) {
      if (img.pixels[i] == 60896) cmask.pixels[i] = color(#FFFFFF);
      else cmask.pixels[i] = color(#000000);
    }
  }
}

//test

I'm getting a syntax error on the last line (the comment) about an unexpected '}'. It's not even on that line.

edit: it's more fun than that.
costume.pde:

Code:

//Moving back into simplicity.pde!
//test

same thing.

edit again:
deleting costume.pde causes the error to move to sprite.pde, which moving the contents back into simplicity.pde moves the error to todo.pde. todo.pde is one big comment. deleting that moves the errro to the end of setup() in test.pde, and moving that causes...

grrmrrhrrmrrhrr
Lemme go checkout again.

Last edited by scratchisthebest (2012-06-14 11:00:52)


bye 1.4, we all loved you. but we all outgrew the site. 2.0 is a welcome change.
http://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.pnghttp://scratch.mit.edu/img/Pico3-med.png

Offline

 

#68 2012-06-14 11:24:06

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Simplicity: Scratch in Processing

From my limited knowledge of Java syntax, should it not be:

Code:

      if (img.pixels[i] == 60896) cmask.pixels[i] = color(#FFFFFF) else cmask.pixels[i] = color(#000000);

If that still doesn't work, you could try putting braces { } around the if and else block.

Just a thought!  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#69 2012-06-14 12:41:17

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

Re: Simplicity: Scratch in Processing

blob8108 wrote:

From my limited knowledge of Java syntax, should it not be:

Code:

      if (img.pixels[i] == 60896) cmask.pixels[i] = color(#FFFFFF) else cmask.pixels[i] = color(#000000);

If that still doesn't work, you could try putting braces { } around the if and else block.

Just a thought!  smile

It shouldn't be, actually.

And I though I had commented that part out.
Oh wait no it was only the part where it draws it.

Well, I don't mind if you comment the mask out; I was going to use it for something but I'm not anymore.


Posts: 20000 - Show all posts

Offline

 

#70 2012-06-14 13:05:50

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

Re: Simplicity: Scratch in Processing

The #FFFFFF will throw a syntax error.


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

Offline

 

#71 2012-06-14 13:39:12

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

Re: Simplicity: Scratch in Processing

MathWizz wrote:

The #FFFFFF will throw a syntax error.

Huh?


Posts: 20000 - Show all posts

Offline

 

#72 2012-06-14 13:54:15

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Simplicity: Scratch in Processing

veggieman001 wrote:

It shouldn't be, actually.

Ah, cool. I didn't know you could do that  smile

veggieman001 wrote:

MathWizz wrote:

The #FFFFFF will throw a syntax error.

Huh?

From a quick look at the processing docs, isn't MathWizz suggesting you can just write #000000 rather than color(#000000)? I don't think that fixes the problem, though.

Last edited by blob8108 (2012-06-14 14:00:55)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#73 2012-06-14 13:58:39

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

Re: Simplicity: Scratch in Processing

Interesting... I thought Processing was simply a Java IDE + library with the regular Java compiler. In regular Java, #000000 would give a syntax error.


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

Offline

 

#74 2012-06-14 14:01:31

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Simplicity: Scratch in Processing

MathWizz wrote:

I thought Processing was simply a Java IDE + library with the regular Java compiler.

Yeah, me too  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#75 2012-06-14 16:15:10

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

Re: Simplicity: Scratch in Processing

MathWizz wrote:

Interesting... I thought Processing was simply a Java IDE + library with the regular Java compiler. In regular Java, #000000 would give a syntax error.

Yeah, it's not exactly the same, although similar.


Posts: 20000 - Show all posts

Offline

 

Board footer