0 Favourites

specific scrolling

  • Hi!

    Is there a way to make the camera scroll to my player sprite but only on the X axis?

    The trciky part is that the Y axis should be scrolled to certain heights depending on the part of the level, regarding of the player standing or the ground or jumping.

    I guess I should create different invisible objects through the level so everyime one of those is onscreen it scrolls to it's specific details.

    Is this too tricky? what would you reccomend?

  • I'm thinking on something like this:

    Every "S" would be an invisible sprite that marks the Y scroll for each part.

    The thing is how to make every S work only when the player is close to it (can it be made using always the same sprite or does every S have to be a different sprite?) and how to change smoothly from one scroll to the next.

  • thanks!! very useful answers

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Did you want something like this? There are 2 different scroll to options in there.

  • thanks!! let's check.

  • I modified it a little. I think it's closer to what you want.

  • yes, ti would be something like that. the thing is how to make a transition in the scrolling so it doesn't shift so suddenly

  • Ouch... This one hurt my brain! But it was fun to get it figure out. In the Set scroll to Y line you can adjust the final 0.05 to change the scroll to speed.

  • I can't find that 0.05 you mention!

  • Sorry, I guess that one hurt my brain too much. I uploaded the wrong file. Here is the correct one.

  • It works

    thanks a lot!

    I wanna ask 1 more thing (I don't know if it's possible to do):

    Is it possible to have the scroll shit only as the player moves? I mean: when he gets to a certain zone the Y scroll shifts but only if the player keeps avanzing.

    Maybe it's something like having a path made of the same sprite over and over and telling construct to keep those sprites out of the screen. so, the camera would adjust going down, let's say, to keep those sprites beyond the upper limit of the screen. So, that way you can mantain the camera in the height you desire. Is this too weird?

  • Are you talking something like this.

    (Note: Walk slowly - when you reach a hit zone the camera shifts only while you are moving.)

  • works!!

    Thanks a lot.

    how would this work?

    I mean, you have this expression:

    lerp(CanvasToLayerY(0, WindowWidth/2, WindowHeight/2), Sprite.Y, 0.05)

    I've searched on the help files of construct but it doesn't mention "lerp", or I couldn't find it. What is it used for? how would be the overall meaning of this expression?

  • Both lerp and CanvasToLayerY can be found here:

    https://www.scirra.com/manual/126/system-expressions

    [quote:3kvp8g7r]CanvasToLayerY(layer)

    Calculate the layout co-ordinates underneath a position in canvas co-ordinates for a given layer.

    and

    [quote:3kvp8g7r]lerp(a, b, x) Linear interpolation of a to b by x. Calculates a + x * (b - a)

    So lerp will move from a to b by x.

    For a we want the Y position on the layout of where the camera is centered. This is our starting point. So for that I used CanvasToCenterY(Layer#, X, Y). I didn't see the requirements inside the parenthesis in the manual, but that is what is needed.

    For b of the lerp expression I use the Y value of the sprite.

    And for x I use 0.05.

    My brain is hurting again just thinking about this... <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • oh gawd. I really didn't get a thing.

    But thanks, really, for trying to explain it

    maybe some day I'll get it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
118 32,893
rexrainbow's avatar
rexrainbow
Unread hot topic
31 2,813
mammothe's avatar
mammothe
Unread hot topic
44 1,897
inquiesco's avatar
inquiesco