Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Nerd moment! It’s very simple actually!

  1. Randomly generate a value of (-1 or 1) lets call it “x”.
  2. Create a “factor”, “max_angle” (mine is 45deg) and “difference”(i used 0.2) variables. (NOTE: difference should be anywhere from 0 to 1, higher = faster angle variation.)
  3. Set “factor” to (“factor” + “difference” * “x”) and clamp it between -1 and 1.
  4. Take your player input direction vector and rotate it around (“max_angle” * “factor”)
    You can use lerp, to smooth out the movement. Thanks for asking. I love nerding about my stuff!
(+1)

That's super interesting! I appreciate the response.