Actor following finger touch
Billyd1
Member Posts: 133
I am creating a new game idea and want to make my actors follow a line where my finger has scrolled and once they reach a certain point both disappear.
If you have played Flight Control or Harbor Master you will know what I am talking about.
If anyone knows how that would be great.
Thanks
If you have played Flight Control or Harbor Master you will know what I am talking about.
If anyone knows how that would be great.
Thanks
Comments
call 1 of them: MyFingerTouchX
call the other: MyFingerTouchY
Then create your actor to follow the finger.
In that...add two constrain functions
Constrain Attribute game.MyFingerTouchX to game(via Devices).Mouse.Position.X
Constrain Attribute game.MyFingerTouchY to game.Mouse.Position.Y
(note these can also be linked to a Touch1 setting)
Then add a rule...
Rule:
when Touch is Pressed:
Constrain Attribute self.position.X to game.MyFingerTouchX
Constrain Attribute self.position.Y to game.MyFingerTouchY
Then add another rule...
Rule:
when Touch is Released:
Change Attribute self.Alpha = 0
Notice I did not destroy it...this way you can turn it back on later if you need it.
If you know you will never need it again...you can go ahead and destroy it.
If you want your actor to follow in a delayed manner you can substitute a moveTo inside a looping timer instead of the constrained attributes inside the rule using the same logic sequence.
hope this helps!
Syn-