d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Iso Beginner Java Help
Add Reply New Topic New Poll
Member
Posts: 32,450
Joined: Jul 9 2007
Gold: 15.00
Jan 17 2013 04:45pm
doing a lab for my computer science class
trying to make a shape move by itself across the screen or something like that
let me know if any of you know how to do this.
this is a beginning class so dont need anything complex
Member
Posts: 32,450
Joined: Jul 9 2007
Gold: 15.00
Jan 17 2013 05:07pm
if anyone has Processing
please help me out with this

void setup(){
size(500,500);
}

int value1 = 0;
int value2 = 212;
int value3 = 247;


void draw(){

background(value1,value2,value3);
fill(247,150,2);
ellipse(mouseX,mouseY,100,100);
fill(255,255,0);
ellipse(mouseX,mouseY,50,50);
}

void mouseDragged(){
value1 = value1 - 2;
value2 = value2 - 2;
value3 = value3 - 2;

}

that is what i have so far, so when i press down the mouse and drag the color changes to black, but how do i change it back to the original color?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 17 2013 07:36pm
keep a variable for previous colour.

and i dont know what "Processing" is that i can have.

This post was edited by carteblanche on Jan 17 2013 07:39pm
Member
Posts: 2,478
Joined: Jan 4 2007
Gold: 7,545.00
Jan 18 2013 08:29am
Set up an event to wait for mouse release and set the color back to the original.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll