• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Hurtboxes functioning oddly

B

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.
 
Top