jeudi 8 décembre 2016

ActionScript 3.0 The hitboxes on my enemies seem way too big, how to fix?

The hitboxes on the enemy sharks seem way too large, is there a way to fix this? make the hitbox smaller? So far, hitTestPoint has been the only thing working for me. I've heard of someone using bitmap in order to get accurate pixel perfect hitboxes but no idea how to do this.

This is the Collission script for one of my enemies:

    addEventListener(Event.ENTER_FRAME, hitTest);
    function hitTest(evt:Event)
     {
        if(shark.hitTestObject(enemy1))
        {
        trace("player collided with enemy");
               currentHP -= 1;
               if(currentHP <= 0)
               {
                   currentHP = 0 
                   trace("you died!");
                   MovieClip(this.root).gotoAndStop(1,"Game Over");
            }
            updateHealthBar();
        }

Aucun commentaire:

Enregistrer un commentaire