閑來無事 寫的 小游戲,今天把 核心部分 代碼分享給大家
主要游戲玩法:把一組有著正確順序的組合,隨機分放在一個矩形區域,然后通過滑動進行左右上下替換,直到隨機的組合變成正確順序的組合
現在只支持了簡單的 文字和圖片的 組合,如果有別的想法的寶寶們,可以留下你的評論
游戲地址
GitHub 代碼地址
如果對你有幫助,走過路過請在GitHub留下你的星星。
展現圖片的拼接
YFSampleViewController *gameVC = [[YFSampleViewController alloc] init];
// 需要拼接的圖片
gameVC.gameImage = [UIImage imageNamed:@"YFMVB"];
// 每行分割多少塊
gameVC.rows = 2;
// 每列分割多少塊
gameVC.columns = 3;
[self.navigationController pushViewController:gameVC animated:YES];
展現文字的拼接
YFSampleViewController *gameVC = [[YFSampleViewController alloc] init];
// 總數 需要是 rows X columns
gameVC.textArray =[NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", nil];
gameVC.gameViewScale = 1.0;
gameVC.rows = 3;
gameVC.columns = 4;
[self.navigationController pushViewController:gameVC animated:YES];
一下是效果圖
