Reducing Memory Usage While Using Direction

If your object is using direction, there is an incredibly simple way of reducing the amount of memory it needs.

Object using direction: Step event

if direction>360
if direction<0

Since direction is measured in degrees, and 360 degrees is one complete rotation, adding or subtracting 360 will have no effect on the direction the object is facing. Using this code, direction will be capped between the values 0 and 360, preventing unnecessarily high or low values.

Written by NAL

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License