How do I create a chain for a dog.

0 favourites
  • 10 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • I have a dog sprite that has a bullet behavior on it and he runs right and left...now I want a chain to extend out

    and follow the dog...

    Now a friend suggested that I use a tiled background and I am and in my event sheet I have every 5 sec, set width of dogchain.x +32... something like that...

    is there a way to set two pivot points on my tiled background image...one to pin to the dog house and one to pin on the dog..and have it automatically stretch in and out depending on the pos of the dog?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could use a small sprite, place it at the center of where you want the chain to originate, than every tick, set angle towards dog, and set the width to distance(chain.x, chain.y, dog.x, dog.y) That could give you the effect you are looking for if I understand you correctly.

  • chainTiled.X, chaintiled.y, dog.x,dog.y

    this is what I put down for the Set width to distance and I get an error, something about the syntax.

  • Could you post your capx than I might take a look and see where the error is.

  • dog chain code is in Event sheet 1 at the very bottom.

    http://www.dwbailey.com/images/dogchain.capx

  • Ok I've taken a look at your capx, haha but it was quite cluttered so I am a bit lost, sorry. But I get an idea of what you are trying to do, so I've created a simple capx that should help you understand and implement into your game. Just two important things though, I used a sprite in the example, but you can still use a tiled background. If you do use a sprite, remember to set the image point for the chain to the left or right and not the middle.

    https://www.dropbox.com/s/hz5n91gg4la9fgp/DogAndChainExample.capx

  • thanks a lot for doing that for me. I still need to understand expressions and how to use them. I noticed in your math you put distance in there..i didnt even put it there when i tried it.

    anyway got it to work..i tried it using tile background but got bad results because you can put image points in a tile background, so the start point was all wierd.

    everything looks good except the stretching that i get.

  • Ill stick with it stretching like that. when the dog moves back and forth i tried to make it like he is being pulled back from the chain anyway. So the stretching helps sell the idea.

    still would be nice to know how to fix that if possible for future ref.

  • Glad to know it's helped solved your problem.

    I think you could still use tiled backgrounds. In the left properties bar, in the hotspot section, make sure it is set to top left. It might not be as perfect as using sprite with its image point option, but it could still work. If you add some clever objects on top to hide the main hotspot where the chain turns, you could still get nice results.

    I've created a new example with what I mean, so hopefully you might still be able to use tiled backgrounds.

    https://www.dropbox.com/s/y412q5jehlplxpg/DogAndChainExample2.capx

  • thanks for that 2nd example. i still need to tweak mine, I never new about the hotspot. I really wish there was a Expressions thread that did several examples for each one.

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