1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 Hurtboxes functioning oddly

Discussion in 'Programming' started by Bearious, Sep 8, 2018.

  1. Bearious

    Bearious Guest

    I'm really at a loss here. My hitbox/hurtbox code works perfectly fine with a single instance of an enemy object, but stops working for all enemy objects past the first. So clearly, the code works, but has some odd issue with additional instances. There is nothing in my code preventing or disabling interactions with additional enemies so I am very confused as to the nature of this issue. If anyone could give me any insight, I would really appreciate it.

    https://imgur.com/qstKme6

    https://imgur.com/FMKlX8f

    My hit detection code is pretty simple, I just followed a tutorial. The following code fires from the hitbox instance, created by the player.

    Code:
    if place_meeting(x,y,oEnemy.hurtbox) {
        var inst = instance_place(x,y,oEnemy.hurtbox)
     
        for (i = 0; i < ds_list_size(hitList); i++) {
            if hitList[|i] == inst.owner {
                ignore = true;
                break;
            }
        }
        if !ignore {
            ds_list_add(hitList, inst.owner);
            inst.owner.hit = set_hit(damage,attackAngle,hitDirection,moveDistance,hitStunTime);
            inst.owner.state = AI.Hitstun;
        }
    }
    The hurtbox code is basically nothing. It just creates a box and attaches it to the enemy.
     
  2. Bearious

    Bearious Guest

    Never mind I figured it out lol
     

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