Announcement

Collapse
No announcement yet.

2D Side Scroller AI?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    2D Side Scroller AI?

    How would I go about blueprinting enemy AI so they patrol between two points?

    #2
    Just like you would do for regular AI. But instead of mobveto use simple move, or write own task.

    Comment


      #3
      Sometimes I think its easier to code this kind of thing directly into the Enemy blueprint since its so simple.
      Make 2 exposed variables(vectors) "pointA" and "pointB" and show their 3d widget. Then add an addMovementInput node to your event tick and set its relevant scale to -1 or 1 based on the last point it touched.

      Comment


        #4
        Is there anyway to put a navmesh onto a 2D map? I am looking for the same thing. I want to add a basic AI to a 2D game.

        Comment


          #5
          I don't see why not. Is it a retro style game or high res? My practice run with Blueprint was reverse engineering Pacman. I got a nav mesh to work with it fine it just needed a lot of futzing with the nav mesh settings because it was so small. I find that if I'm doing a 2d game now I like to set the pixels to units measurement to 1 square = 100 units. For example, if I made a SNES style game which has 16x16 textures for the floor tiles, I would set the pixel per unit to 0.16. That way I know that if I want to knockback an enemy about 3 squares, he needs to move 300 units - easy math and a lot more engine defaults (such as movement speed) work better at this size.
          In either case, Tilemaps didn't exist when I was working on that now that they do I've stopped using nav meshes for my AI in 2d games. I don't see why a nav mesh would treat collision on a tilemap any differently than normal but you may need to set its Z height to 100 units or higher in the tilemap editor to get it to see it, I think the default on that is lower than the character's step up height. If not, you can always add collision in manually with blocking volumes, a bit of a pain but if push came to shove you could setup a script to generate collision volumes over each tile that should have it automatically. I'd wager it works out of the gate with the right sizing and z collision height.

          Comment

          Working...
          X