1.把圖變好看
fill(#FF4617,65);
rect(x1, y1, x2-x1, y2-y1, 6); //圓角半徑
2.加球框
2-1.宣告:
PGraphics star1, star2, star3, catch1, catch2;
//考慮之後可能會有多顆球、多個球框,因此用PGraphics 、改自星星
void catch_setting() {
catch1 = createGraphics(55, 55); //球框大小
catch2 = createGraphics(45, 35);
drawcatch(1);
drawcatch(2);
}
void drawcatch(int x) {
if (x==1) {
catch1.beginDraw();
catch1.background(#101593);
catch1.text("come on",10,10);
catch1.endDraw();
} else if (x==2) {
catch2.beginDraw();
catch2.background(#101593);
catch2.endDraw();
}
}
void ball_catch(int x, int catchx, int catchy, float ballx, float bally) { //判斷碰撞
if (x==1)image(catch1, catchx, catchy);
if (x==2)image(catch2, catchx, catchy);
if ( ballx<(catchx+55) && bally<(catchy+55) && ballx>=catchx && bally>=catchy) {
if (x==1) {
println("Your score=",final_score);
}
if (x==2) {
println("Your score=",final_score);
}
}
}
3.replay鍵
1.清除線cleanline()
2.重新計分
3.星星歸位
4.球回到原位
void replay(float ballx, float bally,int star1X, int star1Y,
int star2X, int star2Y,int star3X, int star3Y) { //重來鍵(球x座標,球Y座標)
cleanLines(); //清除線
ball.setting(ballx, bally);
ball.vx=1;
ball.vy=-1;
moving=false;
star_setting();
star_beg_clear_end(1, star1X, star1Y, ball.x, ball.y); //重新show一次星星
star_beg_clear_end(2, star2X, star2Y, ball.x, ball.y);//第i顆星星,x座標,y座標,球座標
star_beg_clear_end(3, star3Y, star3X, ball.x, ball.y);
}
------期中結束------
已完成:
1.用滑鼠畫線
2.球框接球
3.重新開始按鈕
4.球會動(運動軌跡待改善,會卡在邊邊)
5.墨水量
6.星星計分
期末目標:
1.加炸彈,碰到就gameover
2.重力顛倒
3.線會受到重力影響,線的轉動、掉落
4.固定支點(支撐線的)



沒有留言:
張貼留言