deepnight / gameBase

Base structure for my games, using Heaps framework and Haxe language.
https://deepnight.net
MIT License
614 stars 152 forks source link

onPosManuallyChangedX/Y #69

Closed deepnight closed 2 years ago

deepnight commented 2 years ago

    /** Should be called when you manually modify both X & Y entity coordinates **/
    function onPosManuallyChangedBoth() {
        if( M.dist(attachX,attachY,prevFrameAttachX,prevFrameAttachY) > Const.GRID*2 ) {
            prevFrameAttachX = attachX;
            prevFrameAttachY = attachY;
            hud.notify("recal");
        }
        updateLastFixedUpdatePos();
    }

    /** Should be called when you manually modify entity X coordinate **/
    function onPosManuallyChangedX() {
        if( M.fabs(attachX-prevFrameAttachX) > Const.GRID*2 )
            prevFrameAttachX = attachX;
        lastFixedUpdateX = attachX;
    }

    /** Should be called when you manually modify entity Y coordinate **/
    function onPosManuallyChangedY() {
        if( M.fabs(attachY-prevFrameAttachY) > Const.GRID*2 )
            prevFrameAttachY = attachY;
        lastFixedUpdateY = attachY;
    }