Grid Movement behavior and Solid objects

This forum is currently in read-only mode.
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • Hello.

    I make an enemy, which must be controlled by the computer AI. The sprite has Grid movement behavior, Movement is NPC. Using conditions I set that it must move randomly in the scene (in horizontal and vertical directions).

    Question is : how to make that object with Grid movement behavior collides with other objects with Solid attribute? For example, our object moves to the right and collides with the wall sprite (Solid), it stops, and randomly it continues to move to the top of the bottom along the wall. Because now it moves through the solid objects.

    Thanks.

  • +Does NOT overlap SOLID at (Grid size) pixels

    Go ahead

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • +Does NOT overlap SOLID at (Grid size) pixels

    > Go ahead

    It doesn't work, because the object collides with the wall and stop moving.

  • Well, the idea is to check for obstacle before moving. Before you move right, check if there is a wall (overlap at offset by number of pixels that match the grid size), if there is, don't go there and check other directions.

    I hope that helps!

  • Another event like is overlapping at offset set vertical movement... blah, blah, blah.

    Perhaps with a random chance of going either positive y, or negative.

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