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
|
public static void go(Jeton j){
int y = 0;
int val=500;
boolean trajectoire=true;
boolean animation=true;
int anim=0;
while(animation)
{
posY=j.getposy();
if (trajectoire)
{
y++;
j.setposy(posY+=y);
if(j.getposy()>val)
{
trajectoire=false;
j.setposy(val);
}
}else{
y=(int) (0.7*(-y));
j.setposy(posY+=y);
if(y<1 && y>-1)
{
anim++;
trajectoire=true;
}
if(anim>4)
{
j.setposy(val);
animation=false;
}
}
j.setLocation(0, j.getposy());
System.out.println(j.getLocation(null));
//pan.repaint();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
Partager