I seem to have hit a little roadblock in my game development. Basically, I'm trying to have a power up turn my player's movement into a slightly jittery mess by adding love.math.random() to it's X and Y positions.
When I manually add this to the draw code for the sprite, it works just fine, where the player is constantly jittery, as though it has the coffee shakes. An example of this:
Code: Select all
animation:draw(crusaderBlue.img, crusaderBlue.x+love.math.random(5,10), crusaderBlue.y+love.math.random(5,10), 0, crusaderBlue.scalex, crusaderBlue.scaley)
I've tried creating a variable named walkmode which I add to the X and Y positions. It starts as 0, and if a powerup is picked up, it is changed to the random number, but still nothing. I'm pretty sure it's because it's not constantly updating love.math.random everyframe.
Anyway, I can't seem to figure this out. Am I even making sense here? I feel the answer should be simple but my brain is starting to brick, haha.