• 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!

Player to Enemy Collision Issue

O

O_Steven_007

Guest
Hello, I am currently in the process of creating an enemy AI while following a youtube tutorial. The enemy AI is a simple track the player and over take them. However, after placing a collide script onto the enemy object the enemy object still overtakes and encompasses the player rendering them inert and unable to move. I am trying to get it to where the collisions work whenever the enemy comes in contact with the player yet this issue still remains.

here is the Move_Collide script that I used for the enemy AI.
Code:
var _x = argument [0];
var _y = argument [1];
var _obj = argument [2];

 if (place_meeting(x+ _x, y, _obj))
{
    while (!place_meeting(x+sign(_x), y, _obj))
    {
        x += sign(_x);
    }
    _x = 0;
}   
x += _x;

if (place_meeting(x, y+ _y, _obj))
{
    while (!place_meeting(x, y+sign(_y), _obj ))
    {
        y +=sign(_y);
    }
    _y = 0;
}   
y += _y;
 

Slyddar

Member
Not sure if this is your issue, but just wanted to point out running it in a script, and zeroing the local variable _x and _y, means the speed variable that is being passed, never gets set to zero.
 
Top