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

#101 2012-02-26 14:53:53

wmays
Scratcher
Registered: 2008-05-10
Posts: 500+

Re: Java Official Topic

poopo wrote:

wmays wrote:

Just wondering, but is it possible to define methods like for? Sort of like this...

Code:

repeat(10) {
//code to be executed
}

Is there a way to define the repeat(){} method? I'm making a library for scratch users who want to learn java... it will be like Scratch (sorta).

I don't think there is.  hmm  I'd be happy to help as I know some tricks that might be helpful.

Gotcha. I might even rewrite scratch in Java... I've been learning some tricks, too.


http://i42.tinypic.com/2z5vcz9.gif
http://phpscripthost.comoj.com/imagescripts/ipimg.php

Offline

 

#102 2012-02-26 15:07:59

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Java Official Topic

wmays wrote:

poopo wrote:

wmays wrote:

Just wondering, but is it possible to define methods like for? Sort of like this...

Code:

repeat(10) {
//code to be executed
}

Is there a way to define the repeat(){} method? I'm making a library for scratch users who want to learn java... it will be like Scratch (sorta).

I don't think there is.  hmm  I'd be happy to help as I know some tricks that might be helpful.

Gotcha. I might even rewrite scratch in Java... I've been learning some tricks, too.

if you are please say since i've sort of started this but will need more contributors


http://i.imgur.com/1QqnHxQ.png

Offline

 

#103 2012-02-26 22:02:13

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

TRocket wrote:

wmays wrote:

poopo wrote:


I don't think there is.  hmm  I'd be happy to help as I know some tricks that might be helpful.

Gotcha. I might even rewrite scratch in Java... I've been learning some tricks, too.

if you are please say since i've sort of started this but will need more contributors

I could help, I suppose.

Also, for a repeat loop, you could just have a counter variable and increase it by one until it reaches a given amount. PROTIP: use counter++; instead of counter = counter + 1; it saves space and looks cleaner.  wink


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#104 2012-02-26 23:05:59

wmays
Scratcher
Registered: 2008-05-10
Posts: 500+

Re: Java Official Topic

16Skittles wrote:

TRocket wrote:

wmays wrote:


Gotcha. I might even rewrite scratch in Java... I've been learning some tricks, too.

if you are please say since i've sort of started this but will need more contributors

I could help, I suppose.

Also, for a repeat loop, you could just have a counter variable and increase it by one until it reaches a given amount. PROTIP: use counter++; instead of counter = counter + 1; it saves space and looks cleaner.  wink

That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.


http://i42.tinypic.com/2z5vcz9.gif
http://phpscripthost.comoj.com/imagescripts/ipimg.php

Offline

 

#105 2012-02-27 07:13:24

ROSMan
Scratcher
Registered: 2011-04-29
Posts: 1000+

Re: Java Official Topic

java isn't just good for games, it's good for creating things like pop ups or scrolling ads for websites.

Here's the tutorial im using.


GENERATION 33: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment

Offline

 

#106 2012-02-27 07:16:19

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

Re: Java Official Topic

I think you are thinking about the scripting language "Javascript". This is java, completely different languages but some of the syntax is the same.


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

Offline

 

#107 2012-02-27 08:36:12

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Java Official Topic

wmays wrote:

16Skittles wrote:

TRocket wrote:


if you are please say since i've sort of started this but will need more contributors

I could help, I suppose.

Also, for a repeat loop, you could just have a counter variable and increase it by one until it reaches a given amount. PROTIP: use counter++; instead of counter = counter + 1; it saves space and looks cleaner.  wink

That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.

What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#108 2012-02-27 08:39:16

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

Re: Java Official Topic

Harakou wrote:

wmays wrote:

16Skittles wrote:


I could help, I suppose.

Also, for a repeat loop, you could just have a counter variable and increase it by one until it reaches a given amount. PROTIP: use counter++; instead of counter = counter + 1; it saves space and looks cleaner.  wink

That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.

What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm

MathW did an awesome version of scratch in Java, but never released it.
You couldn't drag blocks to the other pane because it was separate.

And anyways, I really don't see why you're asking them 'what's the point'. You didn't ask Jens that for Snap.  hmm

Offline

 

#109 2012-02-27 08:40:40

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Java Official Topic

Harakou wrote:

wmays wrote:

16Skittles wrote:


I could help, I suppose.

Also, for a repeat loop, you could just have a counter variable and increase it by one until it reaches a given amount. PROTIP: use counter++; instead of counter = counter + 1; it saves space and looks cleaner.  wink

That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.

What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm

If you're gonna say that, so what about, why limit Squeak to Scratch?

Offline

 

#110 2012-02-27 08:41:50

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

Re: Java Official Topic

scimonster wrote:

Harakou wrote:

wmays wrote:


That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.

What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm

If you're gonna say that, so what about, why limit Squeak to Scratch?

Or why make modifications of Scratch?

Offline

 

#111 2012-02-27 08:42:52

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Java Official Topic

ProgrammingFreak wrote:

scimonster wrote:

Harakou wrote:


What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm

If you're gonna say that, so what about, why limit Squeak to Scratch?

Or why make modifications of Scratch?

Well, modding Scratch adds features...

Offline

 

#112 2012-02-27 09:40:08

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

Re: Java Official Topic

scimonster wrote:

ProgrammingFreak wrote:

scimonster wrote:


If you're gonna say that, so what about, why limit Squeak to Scratch?

Or why make modifications of Scratch?

Well, modding Scratch adds features...

Oh, don't get me wrong. I understand and agree that we should have mods.
It just seems Harakou questioned why we should make things already created.  hmm

Offline

 

#113 2012-02-27 09:42:25

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

Re: Java Official Topic

Well, I would assume it would be to try out their skill at java. Or for fun. Either way I see no reason to not try it.  smile


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

Offline

 

#114 2012-02-27 09:49:20

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

*RAGE AT HOW SCHOOL BLOCKS THE DOWNLOAD OF SLICK-UTIL!!!*
(It's a library to make it easier to load graphics and stuff for use with openGL)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#115 2012-02-27 09:54:49

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

Re: Java Official Topic

Lol, you're planning on programming at school xD


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

Offline

 

#116 2012-02-27 09:56:42

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

Re: Java Official Topic

Harakou wrote:

wmays wrote:

16Skittles wrote:


I could help, I suppose.

Also, for a repeat loop, you could just have a counter variable and increase it by one until it reaches a given amount. PROTIP: use counter++; instead of counter = counter + 1; it saves space and looks cleaner.  wink

That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.

What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm

It would help with learning and transition to other languages. Having so many functions and stuff can be really overwhelming for new users.


Posts: 20000 - Show all posts

Offline

 

#117 2012-02-27 10:00:52

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

slinger wrote:

Lol, you're planning on programming at school xD

Yes, so what? Currently I am in a study hall, and in some classes we never do anything anyway...  tongue


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#118 2012-02-27 10:37:06

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

Re: Java Official Topic

Cool enough  big_smile


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

Offline

 

#119 2012-02-27 10:40:06

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

Re: Java Official Topic

i program at school


Posts: 20000 - Show all posts

Offline

 

#120 2012-02-27 12:02:38

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Java Official Topic

Just for the record the reseon you can't make a repeat block is because you would be unable to get the code inside of it. Unless of course you want to program a parser to...Didn't think so


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#121 2012-02-27 13:35:49

samtwheels
Scratcher
Registered: 2011-03-20
Posts: 1000+

Re: Java Official Topic

On occasion I will write programs in Java, but I prefer C++. If I'm making a GUI or a game I use Java.

Offline

 

#122 2012-02-27 15:39:12

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

poopo wrote:

Just for the record the reseon you can't make a repeat block is because you would be unable to get the code inside of it. Unless of course you want to program a parser to...Didn't think so

Well, you could make a method for each class like that. For example,

Code:

Public static repeat (String function, int args int times) 
    int counter = 0;
    while(counter<times){
          if (function.equals("move steps"){
                 moveSteps(args);
          }
          else if (function.equals("switch to costume")) {
                   switchtocostume(args);
          }
          counter++;
    }
}

And so on.

Last edited by 16Skittles (2012-02-27 15:43:15)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#123 2012-02-27 16:55:32

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Java Official Topic

veggieman001 wrote:

Harakou wrote:

wmays wrote:


That's not the point... also, outside of for for loops, counter++ or i++ doesn't work.
Anyway, the point is to simulate scratch.

What are you talking about? The ++ operator works everywhere.

Also, how do you intend on recreating Scratch using Java, and what exactly would the purpose be? Limiting a powerful object-oriented language like Java to the minimal feature set of Scratch seems counter-intuitive to anything other than getting comfortable with using text.  hmm

It would help with learning and transition to other languages. Having so many functions and stuff can be really overwhelming for new users.

I completely agree there, but that's generally why you use something that slowly introduces you to the concepts and libraries.

I think I need to clarify what I was thinking though: The impression I got was that he would somehow be making a Java interpreter that took Java syntax and made it effectively text-based Scratch, which seemed (to be honest) a little silly. I'm not discouraging such an idea, it's just my opinion that it would fill a very narrow window for learning. (Then again, maybe I'm wrong! The simplicity of Scratch paired with a much faster language is enticing.)

I like the idea of a text-based Scratch, however, and Java might be a good way to go about it. If that's what wmays meant, sorry for the confusion.

@ProgrammingFreak: What's Snap? I can't say I've heard of it.  hmm


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#124 2012-02-27 16:59:26

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

Re: Java Official Topic

Harakou wrote:

@ProgrammingFreak: What's Snap? I can't say I've heard of it.  hmm

Really? I think you would enjoy it.  smile
It's an online version of Scratch that Jens and bharvey are developing.  big_smile
Check it out here. Hope you enjoy. I've only played with it a little.  wink

Last edited by ProgrammingFreak (2012-02-27 16:59:35)

Offline

 

#125 2012-02-27 17:04:58

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

Re: Java Official Topic

wmays wrote:

Just wondering, but is it possible to define methods like for? Sort of like this...

Code:

repeat(10) {
//code to be executed
}

Is there a way to define the repeat(){} method? I'm making a library for scratch users who want to learn java... it will be like Scratch (sorta).

I'm thinking this kind of code? (I'm still learning  tongue  )

Code:

static void repeat(int num) {
     for (int i = 0; i < num; i++) {
     }  
}

Offline

 

Board footer