Need help drawing a line from an actor to another actor

adytt

  • Posts: 51
Would appreciate a bit of help in coding a behavior that draws a line between 2 actors.
First actor(pulley) is fixed it's x and y coordinates are always the same while the second actor(platform) moves up and down only on the y axis.
the following code used in a whenDrawing event inside the actors behaviour shows nothing on the screen

Kindly have a look and if you have better understanding of how draw line block works please leave a reply.

Luyren

  • *
  • Posts: 2764
Watch this video: https://youtu.be/diMrZg95Oqw

The only thing you'll need other than what was explain here is the coordinates of your second actor. Either retrieve it in the form of an "actor" attribute, or retrieve its coordinates in the form of a game attribute or some other method.

You'll either use the X/Y on screen of your actors, or you'll have to convert the points into scene space, as explained in the video.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Max Marin

  • Posts: 138
you have to put the code in the scene because otherwise I take the starting point of the actor's x and y
I'm human

adytt

  • Posts: 51
Thank you very much guys, both of your answers helped and now everything works perfectly.