Interpolate problems!

UnicornInvasionUnicornInvasion Member Posts: 301
edited March 2012 in Working with GS (Mac)
Roll Up! I am having difficulty with two major features as you will see in the video! I think I will also need a better name!



As you can see I have two problems
1) when you click a button your character starts moving towards it however when you click a button straight after it like teleports to that button.

2) when there is a wall in the way of a buton and you click it the collide wall goes out the window and it goes straight through the wall.

Please Help!

Comments

  • UnicornInvasionUnicornInvasion Member Posts: 301
    Sorry I just need to bump!
  • anchorsonanchorson Member Posts: 15
    I don't know what kind of behaviors you have used but I will try and help you. I guess that you have used a single prototype for all the buttons. And you have set a Rule which says if mouse button is down, interpolate the "actors position" to the "attribute.button.position",where this attribute (as the name implies) is used for saving clicked buttons position.

    If you did that here is what happens,
    You click a buttonX, the actor starts to interpolate it's position to buttonX but just before it concludes, you click on another buttonY. And when you click on buttonY you set another target for interpolation and since very little time is left for interpolation to finish (like .20 seconds) the actor moves from vicinity of buttonX to buttonY in 0.20 seconds instead of completing the interpolation at buttonX.

    If you can confirm that this is what is happening I might offer a solution.
  • anchorsonanchorson Member Posts: 15
    Ok that confirms what i've been talking about. It may not be the best but here is my solution;

    Under Roll prototype;
    In Move rule;
    Instead of interpolating use accelerate towards.
    Use game.X1 and game.Y1 for destination;

    and add a Stop Rule inside the Move rule;
    All conditions are valid
    Attribute self.position.x = game.X1
    Attribute self.position.y = game.Y1

    Change attribute - self.motion.linear.velocity.x to 0
    Change attribute - self.motion.linear.velocity.y to 0

    if you have trouble understanding that; you can pm me
  • anchorsonanchorson Member Posts: 15
    Or you can use move to instead of accelerate. I think this would be a better idea since accelerate does not always carry the actor to the given destination in shortest path.
Sign In or Register to comment.