Android用の最初のミニプロジェクトとして、シンプルなもぐらたたきゲームを作っています。どうすればいいのかわかりません。私はすべての設定などの基本を知っていますが、ほくろをアニメーション化して、ほくろが上の位置にあるときにタップしてポイントをカウントできるようにする方法がわかりません。画像ボタンを実行してカウンターを上げることができることはわかっていますが(カウンター++)、フレームを穴のほくろから上の位置のほくろに切り替えることができる必要があります。セレクターまたはある種の xml アニメーションと呼ばれる一種のドローアブルを使用するように言われましたが、その方法がよくわかりません。誰かが私に何らかの例を提供してくれたり、誰かが私を正しい方向に向けることができれば、私は感謝しています. ありがとう!
2456 次
2 に答える
0
以前、簡単なもぐらたたきゲームを作成しました。見やすくするために、これを箇条書き形式で書きます。
- First, you have to set a 3 cols and 4 rows table (depends on you).
- Place a picture of a hole in every cell, a total of 12 images.
- You have to place those images in an array.
- The logic is to create a timer and for every tick there's a for loop that reads the array.
- In each array, there's a random boolean generator.
- If it is true, change the picture in that array to a hole with a mole appearing
- If it is false, change the picture to a hole without a mole
- To sum it all up: Every tick, it will loop all the picture(array) and randomize each whether it's true or false. Depending on the value, the picture changes.
于 2012-08-31T09:21:48.563 に答える