LorenzoZoil's Forum Posts

  • Is this the best way to make 8 direction movement and animation for player sprite? I found it stopped working for some reason so I reconstructed the event sheet.

    Link to event sheet: ibb.co/KDLyRqP

    He can't move diagonally down/left but is ok moving any other direction? I don't know why this happens, i've tested pretty much everything.

    He also only plays one walking animation - the left walk animation, regardless of which direction he's going in. I've set up the other 7 animations but they don't show.

    It was working before. It might be the update affecting this. Am I missing something?

  • Works brilliantly! Thank you

  • Each of the 4 follow objects have different initial number values in the offset X and Y variables.

    -10, -20, 10, 20

    But (3) "Assing offsetX of the spawned follower as a value relative to the target position Ex. -10"

    What event should I use for adding offsets X & Y as a value relative to the target position?

    And for (5) "add the offsets of the instance to the coordinates" of player.X,player.Y , how would I add the offsets variables to the coordinates? What would the code look like?

    Event sheet: ibb.co/0MTWkT5

  • I understand where you both are coming from. The instances overlapping when they actually need to is not a problem, even it it does happen often. Its only when there's plenty of room around them and they don't all use it.

    I've added events where instances slow themselves down when another instance is within 100 pixels for example . It hasn't resulted in anything since they all remain slow moving after the event triggers.

    For Diego's method, all my instances (when in LOS) are path-finding to 'Player.X,Player.Y'. But my player's X and Y image point is the ONLY image-point on the Player and it's positioned dead centre. So they're all going to the same position (the central image point). Hence probably the overlapping and walking in a line instead of being spread out.

    I've had a go with giving them each offsets (Event sheet image: ibb.co/pLK2n7L ) but I'm uncertain what needs to be done for "they need to calculate their destination". They all have find player'sX&Y in pathfinder.

  • I have sprites following a player (followers), but when they follow, they at some point all merge together when moving. This is obviously because they're all going to the same place but I would like them to spread out a bit at all times when following player. A bit like a formation.

    At the minute the only variables differentiating them are the pathfinder speeds. top speed, acceleration and deceleration. This of course is NOT what I'm after.

    Is there a way to keep them apart from one another? Even when stopped?

    Visual of problem (GIF): ibb.co/N3QM4rF

    Here's what I'm after (image): ibb.co/1b0QZGY

  • My player has 4 followers from the game start. When they follow my player and my player stops, they continue to find path to player's central image point. So they stop right on top of the player. I understand why this happens but is there a way they can stop on a certain 'radius-line' around the player for example, coming from any direction?? My player gets no breathing space when everyone has stopped.

    I've included a visual of the problem (GIF): ibb.co/whJRMnQ

    Link to wanted result (image): ibb.co/hFZKkqh

    Link to event sheet (image): ibb.co/wgZYjKK

  • Done it! Just replaced the Move To with Pathfinder when player is in LOS. Enemy AI is much better now.

    GIF Visual: ibb.co/hYjxrHp

    Event Sheet: ibb.co/HYWcRgW

    :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ha simple as that. All Done!! Works brilliantly now, thanks!

    What it looks like now (GIF): ibb.co/hYjxrHp

    Event Sheet: ibb.co/HYWcRgW

  • Ok so I toggled the 'Move To' actions to off, since I wont be using move-to anymore to chase the player. I've replaced the move-to player action with 'Find path to player' when in LOS, assuming its going to be more intelligent.

    But when i move player along to the point where he's in sight of the enemy, the enemy stops moving completely, until my player is out of sight again. Then he continues with his original path.

    Is there any better add-ons for this?

    Updated Event Sheet: ibb.co/Pz76VB4

  • My 8 direction enemy moves around smoothly, but he struggles to work his way around an obstacle to reach my player. I have included a link to a visual and a link to my event sheet.

    GIF visual: ibb.co/L0NG694

    The enemy (blue) is initially moving along path

    When player (black) is in LOS, the enemy turns and chases

    But when my player goes north of enemy (past the green obstacles), the enemy 'crashes' into the obstacle and STAYS there, instead of moving around them to get to the player, like a person would.

    Event sheet: ibb.co/ZHd7k6v

  • Ok I tried that (which makes sense), but despite the enemy moving around very smoothly, he still struggles to work his way around an obstacle to reach my player. I have included a link to the updated visual and a link to the event sheet.

    GIF visual: ibb.co/L0NG694

    The enemy (blue) is initially moving along path

    When player (black) is in LOS, the enemy turns and chases

    But when my player goes north of enemy (past the obstacles), the enemy 'crashes' into the obstacle and STAYS there, instead of moving around them to get to the player, like a person would.

    Is this just a LOS thing or is there more to it?

    Event sheet: ibb.co/ZHd7k6v

    I've adjusted the 'Every 0.5 seconds' down to 0.4 seconds but it doesn't really do anything to help.

  • Quick question. My LOS doesn't seem to have an effect now, even tho the enemy is running smooth. Because the enemy is finding path to player every 0.5 seconds, the LOS event is irrelevant. I'm looking to have the enemy react when the player is in range and not just react when the layout starts.

    I tried placing that event (7) in the same loop as the LOS event (4) (so the enemy only finds path to player when player is in sight), but that made the enemy a lot less smooth like it was initially. He stops at an obstacle and doesn't find his way around, even if the player is getting further away?

    Image: ibb.co/m00sDyF

  • Wow it works perfect now! Enemy AI is a lot smoother. Thanks a bunch!!

  • Ok so Ive done that. The animation sprite didn't have any behaviours with it except for Pin. The enemy sprite (base) still struggles to consistently go to the player and stops every so often. I have included a GIF image link to give a clear visual..

    Player - PINK

    Enemy - BLUE

    Gif Link: ibb.co/7Q0QG6c

    Event Sheet Screenshot: ibb.co/3YMy5Dt

  • My enemy sprites are using the pathfinder buts it's not very smooth. They keep stopping randomly and colliding with things when they shouldn't. I suspect this is due to the animation sprite (which is pinned on top) being a lot bigger than the base sprite, meaning it's stops, not because of the base sprite but because the animation sprite on top colliding with a solid for example. I'm not certain that this is the reason though.

    I have included an image link below to show a possible solution I though might make a positive difference and produce better functionality with the enemy sprite as a whole. Will the movement and rotation work better, and with the fighting can the player and enemy bases overlap to preform collision hits with the animation sprites?

    Number 1. is my original base and animation sprites and 2. is a bigger base sprite filling the height and width of the animation sprite. Can this second option work better for pathfinder?

    Also just out of interest is pathfinder a bit touch and go? Its quite new if I'm not mistaken.

    Image link: ibb.co/S7ryyw0