GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Reverse Magnitude Function

I created 2 attributes called finger x,finger y and constrain them to self.position.x and self.position.y (finger). I created an actor and I created a magnitude function in a constrain attribute >> magnitude(finger.x-self.position.x,finger.y-self.position.y) so it records the distance between actor and the finger actor. If the finger actor goes far the actor grows, if the finger comes the actor dwindles. So, How can I make actor grow when finger comes closer and make actor dwindle when the finger goes far. ?

Comments

  • RThurmanRThurman Posts: 2,821Member, Sous Chef, PRO

    It would be something like:
    (sceneWidth/2) - magnitude

  • SocksSocks London, UK.Posts: 12,822Member

    @RThurman said:
    It would be something like:
    (sceneWidth/2) - magnitude

    Yeah, I'd do it like this too, just start with a base value and subtract the magnitude, also min and max might be useful here to limit the largest and smallest sizes the actor is allowed to shrink/grow to.

  • SocksSocks London, UK.Posts: 12,822Member

    Attached is a quick demo file:

  • thank you guys

Sign In or Register to comment.