NPC Movement Problem - Moving only one direction

This forum is currently in read-only mode.
From the Asset Store
Fantasy RPG Human-NPC assets pack of 15 characters
  • I am not very good with AI to start with, but I decided to give it a ago. I am trying to program a zombie like thing to be a "Generic Troll" for my game "The Digital Expedition". He only moves one direction relative to the player and not both.

    Here is what I am talking about:

    <img src="http://img10.imageshack.us/img10/162/eventsheetnormtrollhowt.png">

    What exactly am I doing wrong? I bet its something really simple, too. >_<

    (Also, it is no longer "Orange Block", that's just what I named it for testing.)

  • You can use overlap at offset, just use positive and negative values.

    troll is overlapping player at offset x 10

    -troll set x to .x+1

    troll is overlapping player at offset x -10

    -troll set x to .x-1

  • This is what the event sheet looks like now:

    <img src="http://img97.imageshack.us/img97/162/eventsheetnormtrollhowt.png">

    The Zombie moves and stuff, but he kinda glitches out at some point

    Here's a cap: http://www.mediafire.com/?t4yj0qpp4aimxet

    First one to solve this gets a cookie.

  • Distance gets you the x, and the y, offset gets you the x, or the y.

    You should just use one for your detection.

    Also the way you have it set up your saying if the distance is greater than 300, or the distance is less than 300 then move, but that will make the troll move all the time, and distance() doesn't care if the player is to the left or to the right.

  • Distance gets you the x, and the y, offset gets you the x, or the y.

    You should just use one for your detection.

    Also the way you have it set up your saying if the distance is greater than 300, or the distance is less than 300 then move, but that will make the troll move all the time, and distance() doesn't care if the player is to the left or to the right.

    The reason I had the distances there was so that he would only go after me if I get close to him.

    If it is going to cause problems, how else could I do it without distance(x1,y1,x2,y2)?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Like I said in the first post.

    http://dl.dropbox.com/u/666516/offsetplat.cap

    Offset works well for is left and is right, you just have to get your movement correct, or add additional offset comparisons for the gap made when the troll moves.

  • Like I said in the first post.

    http://dl.dropbox.com/u/666516/offsetplat.cap

    Offset works well for is left and is right, you just have to get your movement correct, or add additional offset comparisons for the gap made when the troll moves.

    WAAAAH! WHY DOESN'T IT WORK!?

    Take a look for yourself: http://www.mediafire.com/?ar0hhprqscyhhwn

  • Your mixing platform with custom movement, and your own custom movements. They just don't mix well.

    I'd suggest, until your more familiar with everything, that you use one behavior for your movements.

  • Your mixing platform with custom movement...

    Erm, the zombie HAD a platform behavior, but I removed it before even making this thread...

    A bug, perhaps?

    Anyways, I am going to make the object from scratch. That way, it should work right, and stuff...

  • Alright, I got him to move and stuff, but he only moves when I collide with it, which means he will just charge at me. I think this would be a cool thing to do instead of slowly trudging along.

    Also, a tad off-topic, but I noticed when I explode exactly 58 grenades, the plug-in crashes, which stops my game. It doesn't have to be at the same time either, just when I reach grenade #58.

    When I DO overload the game with grenades- *PC Blacks out* *Does Cold-Shutdown*

    ...

    ...

    OK, back. Anyways, If I do overload the grenades (Throw them consistently), and reach 50 something grenades exploded, the game crashes, saying that a error was caused by the player_arms object. Which is weird, considering it has almost nothing to do with the grenades. Is this a plug-in bug or am I doing something wrong?

    The cap in my above post contains the same conditions for grenade-throwing functions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)