我试图让这艘太空船沿着一条特定的道路行驶,当它碰到我指定的屏幕的x点和y点时,其旋转角度发生了变化,但看来这艘太空船并未沿着这条道路行驶。
enter code here
private void menuSideShipSetup() {
menushiptypes = 2;
arrivaltime = 4 * 20;
Sideship = new Bitmap[menushiptypes];
Sideship[0] = Utils.loadImage(root,"animasyon/ship_1_1.png" );
Sideship[1] = Utils.loadImage(root,"animasyon/ship_2_1.png" );
sideshipx = 0;
sideshipy = 1920 / 2 - Sideship [0].getHeight() /2;
rightsideshipx = 880;
rightsideshipy = 1920 / 2 - Sideship[1].getHeight() /2;
sideshipspeed = 1080 / 80;
rotateconstantly += (135 - 45) / arrivaltime;
sideshiprotation = -1;
rightsideshiprotation = 1;
rightsideshiprotationy = 1;
private void RightShipMovement() {
if ( rightsideshipx >= 880 || rightsideshipx <=0 ){
rightsideshiprotation = rightsideshiprotation * -1;
}
rightsideshipx += sideshipspeed * rightsideshiprotation;
rotateconstantly += (135 - 45) / arrivaltime;
}
enter code here
private void rightVerticalMovement(){
if ((rightsideshipy >= 1260 )){
rightsideshiprotationy = rightsideshiprotationy * -1;
}
rightsideshipy += (300/35) * rightsideshiprotationy;
}
private void rightVertical2Movement(){
if ((rightsideshipy <= 320)){
rightsideshiprotationy = rightsideshiprotationy * -1;
}
rightsideshipy += (300/35) * rightsideshiprotationy;
}
enter code here
}
enter code here