In the last tutorials, I told you about studio sketchpad.
Another way to working with processing is to run your script into HTML files.
If you want to download the processing then you can get it from processing website.
The download will come with an integrated development environment.
If you want to use your processing sketch then you need to make some changes because I will get errors with the IDE.
The changes I make to fix that is to put into the top of your sketch Ball ball001, and MovingBall mb001;
See the source code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | Ball ball001; MovingBall mb001; class Ball{ float x; float y; float speedX=1; float speedY=1; Ball(float _x, float _y){ x = _x; y = _y; } void update(){ x+=speedX; y+=speedY; } void display(){ ellipse(x,y,20,20); } } class MovingBall extends Ball { MovingBall(float _x, float _y){ super(_x,_y); } void drawline(){ stroke(0,0,100); line(x,y,0,0); } } void setup(){ size(400,400); smooth(); ball001 = new Ball(200,200); mb001 = new MovingBall(100,100); } void draw(){ background(0); ball001.display(); mb001.display(); mb001.update(); mb001.drawline(); } |
Most of these features can be found here.