Using a slider to control spacing between actors

I'm working on a new game and, without getting too into the context, I'm trying to use a slider on the Y-axis to continually increase and decrease the distance between two actors.

The two actors should be moving equal distances from each other to make up this total distance.

The top of the slider will create the biggest gap between the two actors, and the bottom of the slider will bring them almost to the point of touching.

I think that should be clear enough. Let me know if I can make anything less vague!

I would really appreciate any insight you guys might be able to throw my way.

Thanks a lot!

Answers

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

    @SproutLabs said:
    I'm working on a new game and, without getting too into the context, I'm trying to use a slider on the Y-axis to continually increase and decrease the distance between two actors.

    The two actors should be moving equal distances from each other to make up this total distance.

    The top of the slider will create the biggest gap between the two actors, and the bottom of the slider will bring them almost to the point of touching.

    I think that should be clear enough. Let me know if I can make anything less vague!

    I would really appreciate any insight you guys might be able to throw my way.

    Thanks a lot!

    It's fairly straightforward, let me make you a little demo, back in a second . . .

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

    Thanks for responding so quickly!

    Tell me if I'm wrong, but I think your demo is essentially tying each actor to the slider independently.

    I was hoping for a way to adjust the distance between them directly, as their individual positions will be changing regularly throughout the game, which makes direct slider control kinda tricky.

    I figure this might not be possible since the space between actors isn't an actor in and of itself.


    Another potential way my problem could be solved is if I found a way to use a slider of a certain height to move an actor within a much smaller range.

    For instance, if my slider is 400 tall, and I want to move an actor within a distance of 100 tall, how could I make it so that when the slider is at 400, the actor is at 100, and when the slider is at 0, the actor is at 0?

    Basically, I would need the actor to move at a speed 1/4 of the speed of the slider if I want the whole thing to move smoothly.

    Any thoughts?

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2014

    @SproutLabs said:
    Tell me if I'm wrong, but I think your demo is essentially tying each actor to the slider independently.

    Yes, each actor take its X movement from the Y position of the slider.

    @SproutLabs said:
    I was hoping for a way to adjust the distance between them directly

    I don't know what this means, I only speak English, GameSalad and a litl-bt-o-intrnt-spek. Not sure what 'directly' means in this context.

    @SproutLabs said:
    I figure this might not be possible since the space between actors isn't an actor in and of itself.

    Not sure what that means either, sounds quite metaphysical. You can get pretty much anything to move anywhere in relation to anything else with a little bit of maths, the problem is often understanding the question.

    @SproutLabs said:
    Another potential way my problem could be solved is if I found a way to use a slider of a certain height to move an actor within a much smaller range.

    Not sure why the actor's height would have any bearing on the situation, but maybe I simply don't understand what is going on.

    @SproutLabs said:
    For instance, if my slider is 400 tall, and I want to move an actor within a distance of 100 tall, how could I make it so that when the slider is at 400, the actor is at 100, and when the slider is at 0, the actor is at 0?

    Again, I'm not 100% I know what you mean, . . . . . but if you want to map 0-400 to 0-100 then the calculation is simply divide by 4.

    @SproutLabs said:
    Basically, I would need the actor to move at a speed 1/4 of the speed of the slider if I want the whole thing to move smoothly.

    Speed !? Ok, I really have no clue, lol !! :) Initially I thought you wanted a vertical slider that controls the distance between two actors - but I think I might have misunderstood the question, I'm not sure how 'speed' and 'height' relates to situation ?

Sign In or Register to comment.