How do I get enemy to move?

  • I trying to create a grid-based game using tile movement. I got the Player to work fine using the keyboard arrow keys. However, I can't get the AI objects to move under program control. I've disabled Default Controls in the AI's Properties and turned on Simulate Control in an Event. I've called the AI object "Killer".

    What I'm trying to do is to make the Killer object move one tile to the left each time I press the right arrow key to move the player one tile to the right.

    Tagged:

  • Are there other killer objects than the one you are creating in that event? If not then you're picking objects that are not created yet. Create them first then pick them and move them with the button press.

  • Yes, there are other Killer objects that were spawned in a previous iteration of that event. Each time the player moves one tile to the right, I want a new Killer to spawn at a random location and ALL previously spawned Killer objects to move one tile to the left.

    When I press the right arrow key, the Player moves one tile to the right and a NEW Killer is successfully spawned. However, none of the Killer objects are moving. I must be missing something very basic.

  • Tile movement behaviour is disabled?

  • Place the "Simulate" action for the Killer before the System:Create object action.

    You can also remove the "pick all condition" it should work.

    You will first move all existing instances of Killer, and then create a new one at a random spot.

    If you are still encountering issues, consider posting your actual project for further investigation.

  • The Tile Movement property was already Disable.

  • To Kyatric,

    I did as you recommended, and Killer tile movement is now working. Thank you. However, I had to also disable Solid Behavior for Killer objects.

    I wanted to have Killer objects blocked by Barrier objects, as well as other Killer objects. But since I had to disable Solid behavior for Killer, they start overlapping each other on the same tile, rather than queuing up in a line as I intended.

    Is it true that Solid objects cannot do Tile Movement?

  • To plinkie,

    Sorry, I meant to say in my previous post that Tile Movement was already Enabled.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use the "Edit" option in the banner of your post if you want to modify something you already wrote, preventing posting multiple posts this way.

    As I did mention previously, post your project file for further investigation.

  • When you say to post my project file, how do go about doing that?

  • You save your project as a local file (https://www.construct.net/en/make-games/manuals/construct-3/overview/saving-sharing-projects)

    You host that file on an online hosting service.

    You post the public link to the file that the service provides.

  • Thanks for the info. I'll have to look into doing that for more complex questions, where one needs to see the whole project in order to analyze what's going wrong.

    For now, I just need to know if objects with the SOLID Behavior can do Tile Movement.

    I tried an simple experiment. Here a "Player" object has the Tile Movement behavior enabled, but Solid behavior disabled. I have just one event. If Player's X-coordinate = 100, Solid is enabled. When I press the right arrow key Player starts moving right, but when it reaches X-coordinate 100, it freezes.

    It appears that Solid and Tile Movement are mutually exclusive in Construct 3.

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