Friday 4 March 2016

Roll the Dice!

I made a game on Unity that will simulate the outcome of a dice roll, it uses very basic code and usually wouldn't warrant a blog of its own, however it was this game that almost made programming click. I just started understanding it more when doing this, I didn't use any external assistance which is surprising considering my coding ability.

Here is the code:


It's really simple to understand, the computer selects a random number from 1 to 6 then display a message that matches he value of the number, for example rolling a 6 is good so the console will display "lucky you", while rolling a 1 will display "unlucky".


The next step for this game is to have two dice rolls with the cluck of the mouse and then Unity will automatically add the two numbers together. Then eventually I could fit this into a game.


No comments:

Post a Comment