Fancy meeting you here!


Life got in the way for a bit, so I didn’t get the chance to work on this in the last few days. Fortunately, the brain never stops and despite not working, some ideas get polished.

Well then, the next obvious step is to add a few more sentient beings along the level. The way I did it was to trust the random deity and just get all the available empty spaces and use them as valid spots. I get this fairly often, because the number of enemies is also within a certain range:


Sometimes, enemies get clumped up together, or very near the player, but that’s just how it is. Sometimes you just wake up and happen to have something unpleasant near you. Sounds good enough and I’ll stick to that. If it’s random, random it shall be.

Next up, I decided to make it so that enemies get “activated” when the player gets in a certain range, like if the enemies would listen or see the player when he’d get near. It would be easy to just make the enemies rush towards the player immediately, but it is just better to let them behave a bit more fairly.

Currently, this is the full enemy AI script:

///Follow Player
  
if (distance_to_object(objPlayer)<200)
{
    xx1 = x;
    yy1 = y;
    if (mp_grid_path(global.grid, path, x, y, objPlayer.x + 8, objPlayer.y + 8, false))
    {
        xx1 = path_get_point_x(path, 1);
        yy1 = path_get_point_y(path, 1);
       
        if (position_empty(xx1, yy1))
        {
            x = xx1 - 8;
            y = yy1 - 8;
        }   
    }
}

 There is no combat logic and the pathfinding is basic as seen in the following picture:

The enemies just follow a straight line and stop until there’s enough room to move. Not having more spaces, they just stand there, not looking to get closer. I’ll have to fix that later.

Next, I’ll be adding the pickups, but first, a bit of an inventory needs to be put in place, and fortunately, I’ve already devoted some thought cycles into it. 😊

As previously posted, I want to make this simple, so there’s no need to create an immense list of gear, items, etc. for the player to find. I’ll just try to plug it in in a day or two, because there’s a lot of work to be done still.

Read you soon!

Comments

Log in with your itch.io account to leave a comment.

How did you get the enemies to spawn in not knowing where they would show up? In other words how do you check if the place they are spawning in is a valid spawn point?

-Spencer

Nothing major, really, I just capture all free spaces to an array and remove the start and end positions (from my case, the very first and the very last). After that, just take a few random positions for the enemies. I won't be able to work on the game for about two weeks (missing  the competition) because of a certification I'm studying for, but I managed to simplify the level creation.

I'll post my findings a bit later.

Awesome, Thank you! I'm excited to see what you come up with.