specific scrolling

Get help using Construct 2

Post » Mon Mar 24, 2014 8:07 pm

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?
B
5
S
1
Posts: 92
Reputation: 609

Post » Mon Mar 24, 2014 8:28 pm

Are you talking something like this.
(Note: Walk slowly - when you reach a hit zone the camera shifts only while you are moving.)
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Thu Mar 27, 2014 3:07 am

works!! :D
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?
B
5
S
1
Posts: 92
Reputation: 609

Post » Thu Mar 27, 2014 3:49 am

Both lerp and CanvasToLayerY can be found here:
https://www.scirra.com/manual/126/system-expressions
CanvasToLayerY(layer)
Calculate the layout co-ordinates underneath a position in canvas co-ordinates for a given layer.

and
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... :)
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Sat Mar 29, 2014 6:21 pm

oh gawd. I really didn't get a thing.
But thanks, really, for trying to explain it :D
maybe some day I'll get it.
B
5
S
1
Posts: 92
Reputation: 609

Post » Sat Mar 29, 2014 7:35 pm

damn, somehow I can't make it work.

This is what I've done.
My player sprite is called PLAYERBOX and the scrolling sprite is called SCROLLY

I set this event:
PLAYERBOX on collision with SCROLLY/PLAYERBOX platform is moving =

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

To all that I added an everytick event to scroll X to playerbox X

What happens is that once the playerbox touches the scrollY the screen scrolls a little to the downside and stays there. it also does it instanctly, no transition. If you get out of the collision area and enter again this happens again, so every time you do it the screen goes lower.
I've tried taking out the platform condition but nothing changed. I've also tried replacing the PLAYERBOX element in the expression with the SCROLLY but still doesn't work.
B
5
S
1
Posts: 92
Reputation: 609

Post » Sat Mar 29, 2014 9:20 pm

So first off I would say you might want to change the:
PLAYERBOX | On collision with SCROLLY
to:
PLAYERBOX | Is overlapping SCROLLY

I believe that On collision with is only a single event, so you would only get one step out of the lerp expression. The Is overlapping will act like an every tick event as long as you are overlapping the object.

Next I'm wondering if your statement:
...PLAYERBOX platform is moving = | lerp(CanvasToLayer(0...

is a typo or not. Did you really mean to type:

...PLAYERBOX platform is moving = || System | Set Scroll Y to lerp(CanvasToLayer(0...
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Sat Mar 29, 2014 11:41 pm

you're right!
the problem was the collision condition.

now, regarding the PLATORM IS MOVING condition, the problem is that if you stand still and jump (without going forward), the scrolling will still happen. I've tried changing it for "compare speed" but it doesn't discern between X or Y speed. the ideal would be to replace the PLATFORM IS MOVING with something like: "sprite X speed is not zero". Any ideas? :o
B
5
S
1
Posts: 92
Reputation: 609

Post » Sun Mar 30, 2014 12:25 am

Here you go:
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Mon Mar 31, 2014 4:44 am

great!
:D
I even managed to make the scroll X work only when walking right by creating a sprite that follows the position of the player but only if it walks right. when the player goes left it leaves the sprite behind so it gives the illusion that the player "pushes" the scroll sprite. By making the screen scroll to that sprite it gives the same sensation of contra, where you can go right but the screen won't follow if you go left.

now I want to see if i can do the same but with zoom. I mean, make the layer go smaller progresivelly as you advance. Just the same thing you helped me with regarding the Y scroll but with zooming. But I think I'll create another topic on that in case i can't pull it off.
B
5
S
1
Posts: 92
Reputation: 609

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests