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
{
direction-=360
}
if direction<0
{
direction+=360
}
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
page revision: 0, last edited: 12 Aug 2008 15:50