Look ahead camera

Discussion and feedback on Construct 2

Post » Sun Oct 11, 2015 7:06 am

Message: immortalx can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi guys.
I've made a simple look ahead camera that has a quick "forward focus" effect when the player is running, but has a slower reset time when the player stops. It seems to work well except when doing a static jump. In that case I want it to behave like when the player has stopped moving, but I can't for the life of me figure out how! Any help would be appreciated.

The way it works is by pinning an invisible box sprite to the player sprite and constantly adjusting the box's width. The box sprite has its origin and one additional image point at opposite ends. That way, it only grows at the direction the player is facing and the window scrolls to the aforementioned image point.

I hope my English makes sense and forgive any mistakes cause it's not my mother tongue!

https://dl.dropboxusercontent.com/u/14855413/lookaheadcamera.capx
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Sun Oct 11, 2015 9:24 am

Why not just check the x position of the camera every tick. If there is no difference then dont move the camera.
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Sun Oct 11, 2015 11:26 am

@spongehammer Thanks a lot for taking the time to check this!

I tried your suggestion by making an instance variable and storing the X value every tick. Then I do a comparison on the variable and it works partially (camera stops going ahead when static-jumping), but when the camera is in reset mode the static-jump cancels out that movement.

My post count doesn't allow me to post screenshots so that I can explain better what I mean.
Any suggestion is welcome
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Sun Oct 11, 2015 12:05 pm

@immortalx can you not connect the camera to the state of the player, running = camera follow , or maybe if you can get the x-speed of the character, when over a treshold the camera comes active,.. just some idea's here..
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Sun Oct 11, 2015 6:11 pm

Thanks @vtrix, it seems you and @spongehammer were right!. Tracking for a change in X position alone did the trick. I was also checking for Platform->Is Moving condition, but that apparently means a change in both X and Y.
Consider this solved and I hope someone will find this camera useful.

New capx:

h*tps://dl.dropboxusercontent.com/u/14855413/lookaheadcamera2.capx
B
13
S
5
G
1
Posts: 116
Reputation: 1,805


Return to Construct 2 General

Who is online

Users browsing this forum: AnimH01 and 11 guests