[問題]跟電流急急棒有點像的object-c程式寫法疑問
目前我的想法是希望用滑鼠畫出黃色線
如果黃色超出了紅色路徑的範圍
那會跳出警告的視窗
目前用這種寫法:
if(36<currentPoint.x<=50) { //第一段路
if (105<currentPoint.y<107) {
...//其他的if else來控制其他段路
}
else {
UIAlertView *alert =[[UIAlertView alloc]
initWithTitle:@"Wrong way!"
message:@"Finger has been lifted off the
screen."
delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
drawImage.image=nil;
StartGame.hidden=NO;
[Timer invalidate];
alertPressCount++;
}
}
不過一直不成功
而且始終覺得這個方法不是很好
有大大可以提供更好的寫法嗎?
檔案在這:
https://drive.google.com/file/d/0B-4eybT3ZkTaeVJ0NldZVVRXa1E/view
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.114.54.99
※ 文章網址: https://www.ptt.cc/bbs/MacDev/M.1425982891.A.ED8.html
※ 編輯: ljuyentintho (140.114.54.99), 03/10/2015 18:24:21
→
03/11 01:52, , 1F
03/11 01:52, 1F
→
03/11 01:55, , 2F
03/11 01:55, 2F
推
03/11 12:24, , 3F
03/11 12:24, 3F
→
03/11 12:25, , 4F
03/11 12:25, 4F
→
03/11 12:49, , 5F
03/11 12:49, 5F
推
03/11 14:35, , 6F
03/11 14:35, 6F