Generate random number each time and don't include last number

后端 未结 2 418
温柔的废话
温柔的废话 2021-01-25 07:04

I have 4 colors. I want to make it so that the player can\'t be the same color 2 times in a row. When a player collides with an object, the RandomColor() is called.

2条回答
  •  悲&欢浪女
    2021-01-25 07:50

    What you need to do is add a judgement if the RandomColor returns a same color as prev one, just call it again, easy right?

提交回复
热议问题