Pathfinding to object + Moving camera with mouse/touch

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I've just started with Construct3, and am struggling with what I see as two very basic functions that were easy to implement in GDevelop.

    Hopefully someone can help!

    1. Pathfinding

    I want a Human sprite to find the nearest Tree object and move towards it. I've figured out how to pick the nearest one, but the Human goes in completely the wrong direction.

    In the screenshot below, the bottom left Tree is picked as the closest, and the animation is changed so I can see it. On startup, the Human is at the blue circle, but then starts moving to the right for some reason (red arrow).

    (Please excuse the awful graphics, I'm using placeholders whilst I build the functionality!)

    Here are the Events:

    2. Moving the camera with mouse/touch

    It's an RTS-style mobile game, so I want to move the camera by dragging. There are plenty of tutorials and examples available, but when I copy them over (word-for-word), they don't work. All the project settings are the same across my project and the examples/tutorials, same imported objects etc.

    However, nothing happens when I try and drag.

    I have two layers (layer_ui for general UI, and layer_background for all the objects)

    Here's the Events view. What am I missing?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pathfinding logic youre constantly running the event and finding a path. You should do a trigger once to find the path, then the on path found trigger should be its own separate event.

    For the camera try drag and drop behaviour on a sprite that also has scroll to behaviour.

  • Pathfinding logic youre constantly running the event and finding a path. You should do a trigger once to find the path, then the on path found trigger should be its own separate event.

    That worked perfectly, thank you! I assumed that the Find Path action would only happen once, but evidently not!

    Screenshot with working events below for anyone else having this issue:

    For the camera try drag and drop behaviour on a sprite that also has scroll to behaviour.

    I managed to fix this, really simple solution. The Unbounded Scrolling option in the Layout properties wasn't checked for some reason, and that was stopping the camera from moving. The events I shared in my initial post are correct (for anyone else with the same issue)

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