How to control units properly?

  • Hello everyone. I am facing a real problem in Construct 2.

    I have 2 trees and 2 characters which I can control them with mouse selection.

    When I select one person and make him go for chopping the tree, it goes properly and starts to chopping. But when I select the other person and send to chopping for other tree, it starts chopping, but the other person stops chopping.

    If this make you little bit confused, here is my question. How can I invidually stop chopping tree? One person should stick one tree. If I want to him to stop chopping. His tree should stop, not the other tree.

    I also recorded a video for this problem. Here is the link.

    Subscribe to Construct videos now
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of the video you should post your capx file.

    You can add an instance variable TreeUID to the Person sprite. When you assign a tree to a person, set Person.TreeUID to Tree.UID

    This way you will always know which persons chops which tree, and will be able to pick the correct tree in events.

    When you want to stop chopping, set TreeUID to 0.

  • Thanks for your answer. Could you help me on my .capx file. Here is the .capx file. s000.tinyupload.com/index.php

  • I couldn't make sense of your code. There were so many conflicting events running on every tick... I removed and disabled most of them and added my version. It's bare bone, only to demonstrate how to move units and assign them to chopping treas.

    dropbox.com/s/ppolzy3667dkvpc/rpg1.capx

  • I couldn't make sense of your code. There were so many conflicting events running on every tick... I removed and disabled most of them and added my version. It's bare bone, only to demonstrate how to move units and assign them to chopping treas.

    https://www.dropbox.com/s/ppolzy3667dkvpc/rpg1.capx?dl=0

    OMG. That was the best reply I have taken in my whole life :D That's literally what I am searching for. Thank you so much. I will credit you if I can finalize the project :)

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