hy 我正在開發一款Android遊戲,即LUDO遊戲。 我使用了四種不同的陣列來獲得LUDO板在擊中和跟蹤方法上的位置。從LUDO遊戲的png圖像獲取位置
四個不同的陣列如下。
int[] t_LM = { 60, -44, 17, -46, 155, -44, 17, -46, -201, -44, 17, -46,
155, -44, 17, -46 };
int[] t_TM = { 42, 63, 63, 85, 42, 63, 63, 85, 233, 254, 254, 275, 233,
254, 254, 275 };
int[] t_o_LM = { 38, -57, -57, -57, -57, -57, 3, -27, -27, -27, -27, -27,
3, -27, -27, -27, -27, -27, 3, 3, 3, 3, 3, 3, -27, -57, -207, 3, 3,
3, 3, 3, -57, -27, -27, -27, -27, -27, -57, -27, -27, -27, -27,
-27, -57, -57, -57, -57, -57, -57, -27, 3 };
int[] t_o_TM = { 200, 275, 275, 275, 275, 275, 305, 337, 369, 401, 432,
464, 464, 464, 432, 401, 369, 337, 305, 275, 275, 275, 275, 275,
275, 242, 209, 209, 209, 209, 209, 209, 177, 146, 115, 83, 51, 20,
20, 20, 51, 83, 115, 146, 177, 209, 209, 209, 209, 209, 209, 242 };
的LUDO板都一樣遵循
但是當我在模擬器的屏幕座標和地圖顯示這樣的..
的圖像圖片中顯示的粉紅色,黃色和綠色框是我在Hit和trail方法後獲得的座標。
任何軟件或鏈接,有助於解決這個問題,高度讚賞。
在此先感謝
至少對我來說,完全不可能理解你的問題...... – WarrenFaith
你需要照顧每個移動屏幕密度。 –
矩形形狀的公式。本地圖片座標到手機座標 其中pVertices [0] = px; pVertices [1] = py; public void transformLocalToScene(final float [] pVertices){ \t \t int count = pVertices.length/2; \t \t int i = 0; \t \t int j = 0; ( - count> = 0){ \t \t { \t \t \t final float x = pVertices [i ++]; \t \t \t final float y = pVertices [i ++]; \t \t \t pVertices [j ++] = x * this.a + y * this.c + this.tx; \t \t \t pVertices [j ++] = x * this.b + y * this.d + this。TY; \t \t} \t} –