简体   繁体   中英

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. The color combinations are astronomical, so I would like Java to do it for me. 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. 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. Then you'd just set the color variables to a random(); so the colors are chosen randomly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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