HTML5 Huggernaut – cute platformer with grappling hooks

Discussion in 'Made with GameMaker' started by Nallebeorn, Aug 21, 2018.

  1. Nallebeorn

    Nallebeorn Member

    Joined:
    Jun 20, 2016
    Posts:
    219
    [​IMG]
    In Huggernaut, you can't jump. But that's no big deal. Not when you've got a grappling hook! A grappling hook you'll make good use of as you try to hug all your friends~!
    Huggernaut is a cute, colorful and challenging platformer which has you swing around with your hook in 23 levels.

    Are you fast enough to get a star on every level? Well, if you are there's always the speedrun mode which let's you play through the entire game in one go with a timer. And if you're not... Then remember all that matters is that you enjoyed the attempt! ^^
    Play now on Kongregate!
    (also available on Armor Games and Newgrounds)


    If you follow the GMC jams, you might recognize this game from GMC Jam #6 (it was the winning entry), though it was called "HUGS" then. This version is greatly improved, with more than twice the level count, simplified controls, a speedrun mode, visual effects and other polish.
     
  2. Siolfor the Jackal

    Siolfor the Jackal Member

    Joined:
    Jun 21, 2016
    Posts:
    496
    I do remember this, it was a lot of fun. Glad to see you kept working on it, it's looking great.
     
    Nallebeorn likes this.
  3. K12gamer

    K12gamer Member

    Joined:
    Jun 21, 2016
    Posts:
    81
    Really good...currently on level 8...

    What code did you use to keep the aiming cursor inside your screen...
    On most browser games...the cursor (mouse pointer) will wander off the edges...making the onscreen character lose function.
     
  4. Nallebeorn

    Nallebeorn Member

    Joined:
    Jun 20, 2016
    Posts:
    219
    I made a simple JavaScript extension that uses the Pointer Lock API. I should probably upload this as an asset somewhere, but this is the full source code, < 50 lines of JS:
    Code:
    var enabled = false;
    
    var canvas = document.getElementById("canvas");
    canvas.requestPointerLock = canvas.requestPointerLock || canvas.mozRequestPointerLock || canvas.webkitRequestPointerLock;
    document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock;
    
    function lockChange()
    {
    
    }
    
    canvas.addEventListener("click", function ()
    {
        if (enabled)
            canvas.requestPointerLock();
    });
    
    if ("onpointerlockchange" in document)
    {
        document.addEventListener("onpointerlockchange", lockChange);
    }
    else if ("mozonpointerlockchange" in document)
    {
        document.addEventListener("mozonpointerlockchange", lockChange);
    }
    else if ("webkitonpointerlockchange" in document)
    {
        document.addEventListener("webkitonpointerlockchange", lockChange);
    }
    
    document.addEventListener("mousemove", function (e)
    {
        gml_Script_gmcallback_mousemove(null, null, e.movementX, e.movementY);
    })
    
    function pointerlock_is_locked()
    {
        return document.pointerLockElement === canvas || document.mozPointerLockElement === canvas || document.webkitPointerLockElement === canvas;
    }
    
    function pointerlock_enable(enable)
    {
        enabled = enable;
        if (!enable && pointerlock_is_locked())
        {
            document.exitPointerLock();
        }
    }
    
    Apart from this all you need is an extension that exposes pointerlock_is_locked() and pointerlock_enable(bool) to GM.
     
  5. K12gamer

    K12gamer Member

    Joined:
    Jun 21, 2016
    Posts:
    81
    Thanks...That's a lot of complicated stuff...I really need to go back to school and learn coding. :(
    Or...GameMaker can give us a drag and drop icon for that function :)
    Oh...and you should upload it as an asset...because I've never seen it in any online game.
     
  6. Toque

    Toque Member

    Joined:
    May 25, 2017
    Posts:
    562
    That’s fantastic.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice