How do I Move the Camera

Get help using Construct 2

Post » Sat Jan 23, 2016 10:35 pm

There's a point in my game where I need to move the camera away from the player, to another point of interest.

How do I go about moving the camera to a certain X co-ordinate without moving the player? I'd like to to be a smooth scroll to the point of interest, no immediate transitions thanks! ^-^

Please be thorough with your replies.
B
23
S
10
G
1
Posts: 153
Reputation: 2,635

Post » Sun Jan 24, 2016 3:29 am

I have been looking for something same. I hope someone helps
B
11
Posts: 27
Reputation: 448

Post » Sun Jan 24, 2016 8:25 am

This can actually become a fairly complex system. To start experimenting: What I've found to be useful is setting up a sprite that has the scroll-to behavior and having a numeric variable on it that I can adjust at will.

So for instance, if the camera state is 1, it sets position to player.imagepointx(your imagepoint here)/player.imagepointy(your imagepoint here) every tick.

You could have other sprites in the game that can be set to invisible that, when colliding/overlapping the player, can change the numeric value of that camera sprite's variable (let's say, to 2) and have that sprite set it's position to another x/y location or object location.

I would also recommend reading up on lerp and using that to lerp from one position to the other so that you can get a smooth transition from point A to point B.
B
42
S
26
G
22
Posts: 307
Reputation: 15,141

Post » Sun Jan 24, 2016 11:21 am

add a sprite, give it scrollto behaviour, call it camera, pin it to the player..

when you want the focus to change, unpin the sprite and use one of the many movement behaviours to move it to the desired position.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jan 24, 2016 8:32 pm

Thank You guys! That really helped! cheers
B
11
Posts: 27
Reputation: 448


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests