[英]Java Randomized Tile Maker
I am attempting to make a randomized tile maker in Java that will mix up 6 different colors on tiles for a 2d puzzle game. 我正在尝试用Java制造一个随机的瓷砖制造商,该制造商将为6D拼图游戏在瓷砖上混合6种不同的颜色。 The color combinations are astronomical, so I would like Java to do it for me.
颜色组合是天文数字,所以我希望Java为我做。 I have absolutely no clue where to start.
我绝对不知道从哪里开始。 I tried looking it up online with no success.
我尝试在线查找它,但没有成功。 Any suggestions?
有什么建议么?
Let's say you have 4 colors. 假设您有4种颜色。 Red, Blue, Green, and Yellow.
红色,蓝色,绿色和黄色。 You want to make these show up as squares randomly each level you can make a switch statement which says if colorRed > colorBlue, colorYellow, and colorGreen then set this cube to red.
您想使它们在每个级别上随机显示为正方形,您可以创建一个switch语句,该语句指出colorRed> colorBlue,colorYellow和colorGreen,然后将此立方体设置为红色。 Then you'd just set the color variables to a random();
然后,您只需将颜色变量设置为random()即可; so the colors are chosen randomly.
因此颜色是随机选择的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.