简体   繁体   English

我如何在java中制作蛇和梯子游戏的棋盘?

[英]how do i make board for snake & ladder game in java?

I am facing difficulty in implementing the 10*10 board of snake and ladder game in java. 我在java中实施10 * 10板蛇和梯子游戏时遇到了困难。 I am not able to implement such a screen.What should I do? 我无法实现这样的屏幕。我该怎么办? I tried implementing it with a image nd then moving over image with the positions but with this way i am not able tocomplete it. 我尝试用图像实现它然后移动图像与位置,但这样我不能完成它。 Is there any good way of implementing this????? 有没有什么好方法来实现这个?????

Simple Create A a gird(10*10) and a button [10][10] array, set these button on grid. 简单创建一个网格(10 * 10)和一个按钮[10] [10]数组,在网格上设置这些按钮。 now split 1 snake and ladder game background image in 100 pic. 现在拆分1蛇和梯子游戏背景图像在100 pic。 set these spited image on buttons. 在按钮上设置这些spited图像。 now you can access your every number(1-100) position var b[i,j] and set player icon on this button. 现在您可以访问您的每个数字(1-100)位置var b [i,j]并在此按钮上设置播放器图标。

Just a thought, have the original image in a frame and overlay this frame with a transparent image with the same conditions as the orignial image (meaning the snake and ladder coordinates should be the same as the original board). 只是想一想,将原始图像放在一个框架中,并使用与原始图像相同条件的透明图像覆盖此框架(意味着蛇和梯子坐标应与原始板相同)。 Now play the game in the transparent image so that you may not worry about repainting the original image. 现在在透明图像中玩游戏,这样您就不必担心重新绘制原始图像。

As told by Joel please post the code to understand better. 正如Joel所说,请发布代码以便更好地理解。

This link has a design of that game. 此链接具有该游戏的设计。 May be you can take a look. 可能你可以看看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM