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

#26 2012-08-22 19:17:13

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

Proanimation wrote:

Thanks I will add it to the converter.
Though I had the converter add the imports only when they were necessary

adding them as nessessary will work but those three will be necessary of almost every project


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#27 2012-08-22 22:29:24

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

for the green flag i need to know do you want it to be auto clicked when project starts or do you actually want a green flag..


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#28 2012-08-23 15:51:25

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

slayerrobe7 wrote:

for the green flag i need to know do you want it to be auto clicked when project starts or do you actually want a green flag..

I was thinking that we would not show the green flag and that when the program starts it will be auto clicked. In other words we could have that the when green flag clicked block could mean that it would start another method. But if we do that is there a way to call multiple methods at one time with out waiting for one to finish.

Offline

 

#29 2012-08-24 01:15:03

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

Proanimation wrote:

slayerrobe7 wrote:

for the green flag i need to know do you want it to be auto clicked when project starts or do you actually want a green flag..

I was thinking that we would not show the green flag and that when the program starts it will be auto clicked. In other words we could have that the when green flag clicked block could mean that it would start another method. But if we do that is there a way to call multiple methods at one time with out waiting for one to finish.

hmm so when the project starts it auto clicks the green flag. This could work if that every very simply i will work on a code... mean while i will keep this thread up with other blocks until my new book arrives Thursday... when that book arives i will likely have the nessessary knowlage to make the green flag code..


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#30 2012-08-25 11:30:39

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

bump


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#31 2012-08-26 08:35:44

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

slayerrobe7 wrote:

alright here is a code that all games will need to run inside for it opens the window..
note: the symbol <> in this means that these areas will be different for every project

Code:

//First it would be best to have the necessary imports defined..
import javax.swing.*;
import java.awt.event*;
import java.awt.*;

//this code may get confusing 

public class <projectNAME> extends JFrame implements KeyListener, ActionListener {
//code will go here

    <name here>d() {
        super("<nameHere>");
        setSize(SIZE HERE);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //code will go here
        setVisible(true);
    }

Though one thing I don't get is the one function that does the GUI I don't get why you have a letter D floating around. Typo maybe?
http://i46.tinypic.com/2873f55.png

Offline

 

#32 2012-08-27 00:44:57

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

Proanimation wrote:

slayerrobe7 wrote:

alright here is a code that all games will need to run inside for it opens the window..
note: the symbol <> in this means that these areas will be different for every project

Code:

//First it would be best to have the necessary imports defined..
import javax.swing.*;
import java.awt.event*;
import java.awt.*;

//this code may get confusing 

public class <projectNAME> extends JFrame implements KeyListener, ActionListener {
//code will go here

    <name here>d() {
        super("<nameHere>");
        setSize(SIZE HERE);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //code will go here
        setVisible(true);
    }

Though one thing I don't get is the one function that does the GUI I don't get why you have a letter D floating around. Typo maybe?
http://i46.tinypic.com/2873f55.png

yep typo


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#33 2012-08-27 09:59:25

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

I think I found some errors in the code you gave me (I fixed them)  :

Code:

//First it would be best to have the necessary imports defined..(I added the imports)
import javax.swing.*;
import java.awt.event.*; //forgot the . in event.*;
import java.awt.*;

//this code may get confusing 

public class <projectNAME> extends JFrame implements KeyListener, ActionListener {
//code will go here

    <name here>() { //had a floating d around (was a typo)
        super("<nameHere>");
        setSize(700, 700); //added default size
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //code will go here
        setVisible(true);
    }
    
    Public static void main(String[] args) {
         <name of project here> pr = new <name of project here>(); //you didn't add the (); part.
}

I also added some things. I was thinking that we could have that each block has it's own function exept for C blocks hatblocks and broadcast blocks.
http://i46.tinypic.com/2873f55.png

Last edited by Proanimation (2012-08-29 16:58:54)

Offline

 

#34 2012-08-28 00:58:14

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

alright what is the next block you want me to duplicate


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#35 2012-08-28 19:53:08

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

slayerrobe7 wrote:

alright what is the next block you want me to duplicate

Any block you want. Though try to make the most used blocks first.
http://i46.tinypic.com/2873f55.png

Offline

 

#36 2012-08-28 19:55:09

YMIBANWAH
Scratcher
Registered: 2012-06-26
Posts: 100+

Re: Scratch to java project

I was wondering how do you type in the code for multiple sprites and the stage, and how will the code process things in brackets like say [hello] for example?


Ingarts read it today!

Offline

 

#37 2012-08-28 20:27:54

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

YMIBANWAH wrote:

I was wondering how do you type in the code for multiple sprites and the stage, and how will the code process things in brackets like say [hello] for example?

We will worry about that once we are able to make it able to convert with one sprite. Though I think we will make another function or class for each sprite.

http://i46.tinypic.com/2873f55.png

Offline

 

#38 2012-08-29 11:49:27

YMIBANWAH
Scratcher
Registered: 2012-06-26
Posts: 100+

Re: Scratch to java project

I have an idea for the + - * and / operator blocks. first you declare 2 new variables. Then you set them to the values that you are operating on. Next you use the java operator that matches the scratch operator you are using on the variables. Then you set a third variable to the result and put that variable in to the code wherever you needed the operator.


Ingarts read it today!

Offline

 

#39 2012-08-29 16:35:12

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

Yes we could do it that way but then we have to have the converter reconise the first time it declared the variable/int/float whitch would be even more work. I was thinking of having the + and - as separate functions with the first and second float/int as it's parameters and it would report the answer.
Example:

Code:

public static int add { //Sorry I forget if the static part should be in it or not read note#3
float x; //first input
float y; //second input
float z == (x*y); //answer Sorry if I didn't assign the value right I haven't been on
return(z);         //while and won't be for a week or more :(
}
//So when the + block is used you just call this function and set the floats.

http://i46.tinypic.com/2873f55.png

Offline

 

#40 2012-08-29 16:41:41

YMIBANWAH
Scratcher
Registered: 2012-06-26
Posts: 100+

Re: Scratch to java project

I think we should have the set variable block where it simply sets the variable, and if the converter detects that it is the first time you used the variable it declares it before use.


Ingarts read it today!

Offline

 

#41 2012-08-30 19:08:19

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

YMIBANWAH wrote:

I think we should have the set variable block where it simply sets the variable, and if the converter detects that it is the first time you used the variable it declares it before use.

I will add it to the converter once I am able to. Also I has the converter ask for all the variables in the beginning.

http://i46.tinypic.com/2873f55.png

Offline

 

#42 2012-08-31 22:24:36

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: Scratch to java project

Proanimation wrote:

YMIBANWAH wrote:

I think we should have the set variable block where it simply sets the variable, and if the converter detects that it is the first time you used the variable it declares it before use.

I will add it to the converter once I am able to. Also I has the converter ask for all the variables in the beginning.

http://i46.tinypic.com/2873f55.png

coul you please stop with that pic it takes up alot of room


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#43 2012-09-01 16:58:11

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

slayerrobe7 wrote:

coul you please stop with that pic it takes up alot of room

OK I will try to find a smaller one or edit it.

Offline

 

#44 2012-09-14 22:21:25

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

Sorry I haven't been on for a while I just got lucky to even get this post on scratch. I probibly won't be on for a long time (hopefully not)  sad   sad

Offline

 

#45 2012-11-05 18:24:12

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

*bump*

Offline

 

#46 2012-11-05 19:32:01

YMIBANWAH
Scratcher
Registered: 2012-06-26
Posts: 100+

Re: Scratch to java project

Oh wow this is back I might be able to help you a little bit more still.


Ingarts read it today!

Offline

 

#47 2012-11-08 20:31:12

Proanimation
Scratcher
Registered: 2011-08-09
Posts: 47

Re: Scratch to java project

YMIBANWAH wrote:

Oh wow this is back I might be able to help you a little bit more still.

Thanks all help will be needed.

Offline

 

Board footer