I have a character and another actor2. When actor 2 is pressed the character interpolates itself to that position. However I want a line to go in between them Here is a vid!
first make an actor to act as the line and put it in the scene
Make 5 game attributes. 1 boolean, and 4 real. Call them showLine(boolean), targetX, targetY, characterX and characterY (real)
In actor 1: -constrain characterX to self.position.x -constrain characterY to self.position.y
In actor 2 have when touch is pressed: -change attribute showLine to true -change attribute targetX to self.position.x -change attribute targetY to self.position.y
In the line actor have a rule when attribute showLine = true: -constrain self.size.width to magnitude(abs(targetX-characterX),abs(targetY-characterY)) -constrain self.rotation to vectorToAngle(targetX-characterX,targetY-characterY) -constrain self.position.x to characterX+((targetX-characterX)/2) -constrain self.position.y to characterY+((targetY-characterY)/2)
then in actor1 have a rule when its self position x and y equal the positions your interpolating them to, change attribute showLine to false
Comments
Make 5 game attributes. 1 boolean, and 4 real. Call them showLine(boolean), targetX, targetY, characterX and characterY (real)
In actor 1:
-constrain characterX to self.position.x
-constrain characterY to self.position.y
In actor 2 have when touch is pressed:
-change attribute showLine to true
-change attribute targetX to self.position.x
-change attribute targetY to self.position.y
In the line actor have a rule when attribute showLine = true:
-constrain self.size.width to magnitude(abs(targetX-characterX),abs(targetY-characterY))
-constrain self.rotation to vectorToAngle(targetX-characterX,targetY-characterY)
-constrain self.position.x to characterX+((targetX-characterX)/2)
-constrain self.position.y to characterY+((targetY-characterY)/2)
then in actor1 have a rule when its self position x and y equal the positions your interpolating them to, change attribute showLine to false
cheers