Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(4 edits)

Me again. I was playing this again and thought it might be more fun if the opponent attacked more often and at random intervals. I'd do it for myself. I figured out how to change it (and faster is fun) but not how to do a random range. I don't think you can simply put a one line Random.Range or Random.value function there like you can a single number. It will either say it needs to be done in the "main thread" or that it's undefined. Is there a simple way to do it?

Hi! I'm sorry, but it's been years since the last time I wrote code in Unity. I can't remember how it's done. Probably you have to make sure that the random function is returning a number in the same type (float, int, etc...) that the rest of the code is using.

(1 edit)

It actually needed to be put in a separate line and under a function. The Start or Awake functions get recommended for random range. But with those functions, the random interval seemed fixed between attacks and only changed when a new game started. However the Update function works for changing it between attacks.

I didn't think it would take that much research and be that complicated just to replace a fixed number with a random range. But at least I was able to do it. I should be able to get quite a bit more fun out of this game now.