Interpolate Help

I am trying to make a game, i have a actor on screen:
when you click left, it turns goLeft to true.
when you click right, it turns goRight to true.

I am using interpolate to move my actor left and right, My actor is actually two actors right next to eachother because i am trying to make the actor split and one go left and one go right if both goLeft and goRight are true.

This was working perfect with MoveTo, but MoveTo would overshoot where the actor is supposed to go, ruining my game, so i changed to use Interpolate.

Now when I use Interpolate, when BOTH bools are true, it just returns the actor to the middle instead of splitting it to the left and right.

Anyone know how I can accomplish what I want?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Don't use Interpolate. Interpolate can't be interrupted so it's not a good solution for movement that needs to change directions before the destination is reached. Do you have set positions that the actors end up at or do they just move left (or right) until the booleans change value?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • hockeycrazy033hockeycrazy033 Member Posts: 14

    @tatiang said:
    Don't use Interpolate. Interpolate can't be interrupted so it's not a good solution for movement that needs to change directions before the destination is reached. Do you have set positions that the actors end up at or do they just move left (or right) until the booleans change value?

    Yeah I have set positions i want them. I basically have three rows. I have a left position, a middle starting position, and a right position.

    I've also tried using invisible boundaries and collide to stop the actor in place, but two problems, 1 even when setting bounciness to 0 it still bounces from the location i want. And I want my actor to move very quickly side to side, and when you set the speed too fast it can pass the boundary and get stuck on the other side.

    Any ideas? thanks a lot for the response.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It should work with Move To (make sure Run to Completion is not checked). Can you post a screenshot of your rules or a link to download your project file?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • hockeycrazy033hockeycrazy033 Member Posts: 14

    @tatiang said:
    It should work with Move To (make sure Run to Completion is not checked). Can you post a screenshot of your rules or a link to download your project file?

    http://puu.sh/ha3Ql/2e5d858b19.png

    It works for a few clicks, but if you click Right, and then Right again quickly, it goes right past the position its destined for, and flys away forever.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I tried that same exact rule as in your screenshot and the actor never moved beyond the two X position boundaries.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • hockeycrazy033hockeycrazy033 Member Posts: 14

    @tatiang said:
    I tried that same exact rule as in your screenshot and the actor never moved beyond the two X position boundaries.

    You know what, 900 seems to work for 'click', but since im testing on the computer i have move left set to 'click' and move right set to a 'key'. when using the key a couple times fast it will pass the boundary.

    Also 900 is a little slower than i want, and if you use 1000 it passes the boundary on 'click'.

    idk whole thing seems kinda buggy.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You're right, it does get unpredictable at speeds at or above 1000.

    You might try Interpolating to an attribute value:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • hockeycrazy033hockeycrazy033 Member Posts: 14
    edited April 2015

    @tatiang said:
    You're right, it does get unpredictable at speeds at or above 1000.

    You might try Interpolating to an attribute value:

    Idk i just tried your new method, and it seems to have 2 problems. first when you click a bunch of times it will basically teleport to the location instead of moving smoothly. Also it still won't work correctly when I want my actor to split to the left and right, probably because we're using interpolate again.

    This seems like such a stupid problem, its so irritating lol. Maybe i'll just go with the basic move-to and sacrifice speed. idk I gotta figure something out.

    I really do appreciate the help you've given me tho. Thanks so much!

  • hockeycrazy033hockeycrazy033 Member Posts: 14
    edited April 2015

    I decided to just change my game, don't need any of this anymore.

Sign In or Register to comment.