T
TypicalHog
Guest
I want the view to be affected by player's speed, here's what I have:
If I floor() the values below (which I think I should) screen seems to be shaking. (Can be seen in the video)
Is it OK if I leave them as a floating point number?
Also, do you have any suggestions how to improve this code?
// View offset
av_hspeed = (av_hspeed * 24 + phy_speed_x) / 25;
av_vspeed = (av_vspeed * 24 + phy_speed_y) / 25;
view_xview = x - (view_wview / 2) + av_hspeed * 32;
view_yview = y - (view_hview / 2) + av_vspeed * 32;
// View size
av_speed = (av_speed * 24 + phy_speed) / 25;
view_wview = global.screen_w + (av_speed * global.screen_w / 32);
view_hview = global.screen_h + (av_speed * global.screen_h / 32);
av_ stands for average.
If I floor() the values below (which I think I should) screen seems to be shaking. (Can be seen in the video)
Is it OK if I leave them as a floating point number?
Also, do you have any suggestions how to improve this code?
// View offset
av_hspeed = (av_hspeed * 24 + phy_speed_x) / 25;
av_vspeed = (av_vspeed * 24 + phy_speed_y) / 25;
view_xview = x - (view_wview / 2) + av_hspeed * 32;
view_yview = y - (view_hview / 2) + av_vspeed * 32;
// View size
av_speed = (av_speed * 24 + phy_speed) / 25;
view_wview = global.screen_w + (av_speed * global.screen_w / 32);
view_hview = global.screen_h + (av_speed * global.screen_h / 32);
av_ stands for average.