DAMMIT SAKURAI! NOW I HAVE TO ADD MORE LINES OF CODE TO THE GAME THAT I'M ALREADY BURNT OUT ON!
@xianc78 Are you not managing changes in the game relative to a dt? Having your logic advance statically per frame isn't a good idea
Monogame should be giving you something like an update(dt) callback that gives you the deltatime (time since last frame, rendering + vsync)
All you have to do for slow motion is to have a multiplier for it
player.x = player.x + (player.velocity * player.speed * dt * speed)
@xianc78 >Having your logic advance statically per frame isn't a good idea
Specifically, either you told monogame the exact framerate it should have or you're relying on undefined behaviour. It might play at 2x or 0.5x speed on someone elses system with 30hz or 120hz screens
If you do manually specify it then it's wasting resources or is artificially laggy, plus possible artifacts like screen tear
>player.x = player.x + (player.velocity * player.speed * dt * speed)
Well, rather you'd have something like
local speed = 1
function mono.update(dt)
dt = dt * speed
player:update(dt)
enemies:update(dt)
...
end
So, you're either using a system where it's really easy to add slowmotion or you have a bad system (prolly, I'm making assumptions)
@xianc78 I would also recommend that you do actually take the time to add a camera offset because slight camera smoothing adds a lot of juice to the game
You have scrolling levels, yeah? So you should already have a camera. An offset and a increment to get close to the "goal" location on the player relative to how far away the camera is from the goal is only a couple lines but adds a lot. Then for shake you randomise it, hints in video #2
Also:
https://youtu.be/Fy0aCDmgnxg
https://youtu.be/tu-Qe66AvtY