import de.voidplus.leapmotion.*;
int x;
LeapMotion lp;
int mapSizex=480; //map x >>>
int mapSizey=480; //map y ↓↓↓
int playerx=mapSizex/2, playery=mapSizey/2; //player place at mid
int i=0; //for
int maxWalkSpeed=2; //move speed
float walkAccelx=0; //x++ speed
float walkAccelxtmp=0; //x++ speed tmp
float walkSpeedx=0; //x start speed
float walkAccely=0; //y++speed
float walkAccelytmp=0; //y++speed temp
float walkSpeedy=0; //y start speed
int maxConnon=20; //max rock how many
float minConnonSpeed=0.1; //rock move low speed
float maxConnonSpeed=5; //rock move fast speed
float[] connonv= new float[maxConnon+1]; //
float[] connonx= new float[maxConnon+1]; //
float[] connonxv= new float[maxConnon+1]; //
float[] connony= new float[maxConnon+1]; //
float[] connonyv= new float[maxConnon+1]; //
float[] connonw= new float[maxConnon+1]; //
boolean gamestart=false; //pan duan start or not
boolean gameover=false; //pan duan die or not
int score=0; //score
PImage img, imgBG;
import de.voidplus.leapmotion.*;
void setup(){
size(mapSizex, mapSizey+6,P3D); //+5 or can't see score
lp=new LeapMotion(this);
img=loadImage("spaceship.png");
imgBG=loadImage("starworld.jpg"); //picture
imgBG.resize(mapSizex, mapSizey+6);
}
void draw(){
background(imgBG);
for(Hand hand : lp.getHands())
{
hand.draw();
int hand_id = hand.getId();
PVector hand_position = hand.getPosition();
println(hand_position.x);
image(img, (hand_position.x), 50, 50, 50);
}
}
沒有留言:
張貼留言