Dog on a leash: line connecting two entities


(B6ka) #1

Hi, I would like to have a line that connects two entities, something like a rope. Think of a dog on a leash and the owner. Both the dog and the owner are separate entities and move autonomously and there is an extendable line between them. I would appreciate if anyone could give a few hints on how to get started with this. I suppose this should be a problem that has been solved before. Thank you.

P.S. the line can be straight, it does not have to be a curve due to gravity.


(Bora Kasap) #2

So, you can use this for your line, you just need to understand, then you’ll get it and change it…

By the way, this lightning “destroys itself” when one of these 2 entities is removed from the world.

Lightning Class for Flashpunk

You can use this to create lightning

Lightning(FP.world.create(Lightning)).init(source:Entity, target:Entity, colors:Array);

(Per_K) #3

import net.flashpunk.utils.Draw;


override public function render():void { super.render();

Draw.line(Ax, Ay, Bx, By, 0xFF0000);

}

There is also a function for Draw.curve.


(B6ka) #4

@AlobarNon @Grok Thank you very much, this is exactly what I needed; Lightning will also be very useful :slight_smile: