Make my dog(NPC) run to the right then turn around and run back, help please

0 favourites
  • 6 posts
From the Asset Store
Run Vovan Run
$1.60 USD
60% off
Full game Construct 2 and Construct 3 to post on Google Play
  • Great morning all,

    Once I provide an input, I want a dog NPC to run to the right for a second and turn around and come back. It sounds simple but nothing is working properly. Its essentially like a patrol but just one loop.

    The trigger for the action is working and the dog will run to the right but once it turn around, it just runs in place for 1+ seconds and then comes back half way. I dont understand what im doing wrong.

    I tried in 2 ways:

    Add platformer to object

    Simulate pressing Right

    On collision with trigger box Simulate left press

    Also the code from the image.

    In general whats the best practice for trying to create a behaviour like this where you want to trigger an action and then have it followed by another? Is this where signals come in?

    thank you again

    Also I noticed if I move my character, it will move the dog NPC in the same direction. Is this somehow related to them both having Platform behaviours?

    Tagged:

  • You have default control activated in platforming behavior. That is why both the hero and the dog react to the keyboard.

    In your screenshot you are running the run animation. Then you move the dog one pixel forward in X. Then you wait 0.8seconds and reflect its sprite and move the dog 1 pixel back in X.

    This code cannot make the dog run.

    You don't know too much, you need to take a tutorial on youtube or read the examples from construct3.

  • You have default control activated in platforming behavior. That is why both the hero and the dog react to the keyboard.

    In your screenshot you are running the run animation. Then you move the dog one pixel forward in X. Then you wait 0.8seconds and reflect its sprite and move the dog 1 pixel back in X.

    This code cannot make the dog run.

    You don't know too much, you need to take a tutorial on youtube or read the examples from construct3.

    Igor just fyi, I appreciate you taking the time to write but your response is not helpful at all. You are correct about setting the animation, it might not be the ideal way to do it but it does work. You also offer no correct way to do it. I hope you are doing fine in life and try to not take out your issues on others, go within and do the work and be honest with yourself

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi.

    As a fellow newcomer to construct and game development myself I can't tell you how to fix your problem (because I'm not 100% sure on how to fix it and I don't want to complicate the problem... Or I would help. :X) What I just did to help myself and suggest you look at is the downloadable "free resources" under the education tab. There's a curriculum in there for educators complete with worksheets that really goes in depth on the functions, behaviors, loops, etc. complete with examples. I learn best from reading and it may not be what your looking for, but it's a way to learn if you choose to use it.

  • thanks for your response. I will definitely check out those resources, I feel like I have the basics down but it wouldnt hurt to go through that material, thanks..

  • My approach if I had to do this would be to give the dog the timer behaviour and change a variable each time it ends. So start a timer for X seconds, then use the condition 'on timer finished' and split out into two conditions if variable=0 set variable to 1, else if variable=1 set variable to 0, and start the timer again.

    This swaps between 0 and 1 each time the timer ends. Then you would have separate conditions for the left and right movement based on the variable. If var=0 simulate left, if var=1 simulate right. You may not need a constant loop like this but this is how I would approach a patrol type mechanic.

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