Smart Camera [SOLVED]

Get help using Construct 2

Post » Sun Mar 10, 2013 5:31 am

I am trying to create a camera system similar to the one described on this blog post.

http://dev.yuanworks.com/2013/03/09/little-ninja-dev-smart-camera-movement/

If you look at that post it shows the camera system they have created it is similar to super mario world and various other "fast" platform games camera systems.

I know how to lerp a camera and I can figure out most of that portion my problems comes with the way to implement the "smart" camera in the link i posted it shows that the player collision box has a "camera box" around it that only moves when the player is at the edge of the box if the player is moving right the box will also move right when the player reaches the edge of the box, upon turning left the camera wont move until the player box reaches the left edge of the box.

now here is my problem, without any of the camera programming how do i just get the "camera" box i make to follow and move with the player in the way shown in the video.

i have tried using 8 directional behavior and having it have high acceleration and deceleration to no avail, the box just zooms past the player, i have had similar camera ideas before i saw this video but none of the methods i played with worked well.

I am just asking about the box movement but if you want to help me more with the camera functions i would appreciate it.

camera control has been a large pain i have dealt with since i started on C2 i can never have it move quite the way i want it to and this box movement seems like an amazing solution but i cant get the camera box to follow the player box sprite at all and its quite frustrating.

to make sure people know what i am talking about look at this video (its also on the blog post which details it in more depth as well as general camera behavior) and pay attention to the first minute or so, where the player has a blue box around them showing how the camera functions.

http://www.youtube.com/watch?feature=player_embedded&v=uAdvFVmW-rE#at=37


EDIT:

I figured it out nevermind, i just needed to take a break and comeback to it anew.BACLog2013-03-10 07:27:18
B
22
S
5
G
1
Posts: 81
Reputation: 2,271

Post » Sun Mar 10, 2013 7:09 am

I'm not quite sure which bit you're stuck on... to implement the camera "box", you want an invisible sprite that's either pinned to the player or has its own logic/movement functions depending on how you want to control lag/lookahead etc.

Then to actually move the camera, use the system Scroll To action.
B
8
S
2
G
3
Posts: 83
Reputation: 2,668

Post » Sun Mar 10, 2013 7:25 am

[QUOTE=tanoshimi] I'm not quite sure which bit you're stuck on... to implement the camera "box", you want an invisible sprite that's either pinned to the player or has its own logic/movement functions depending on how you want to control lag/lookahead etc.

Then to actually move the camera, use the system Scroll To action. [/QUOTE]

thanks for the reply, I actually got the system working exactly how i want it to.

I did not want the box to be pinned to the player but to have the player "push" the box as he touched the edges so the player would always be constrained within the box, but the box would move at the edges, this would allow for the camera to follow but when making adjustments on platforms the camera would be stationary unless the player moved more then 16 pixels left or right, or 180 pixels up and down.

I have solved my problem after taking a break from it and coming back to the project I got it to work by just testing the "camerabox.x" vs the "playerbox.x" and if "playerbox.x" was greater then 16 pixels move it in that direction.
B
22
S
5
G
1
Posts: 81
Reputation: 2,271

Post » Fri May 01, 2015 4:21 am

@BACLog

I know this is about 2 years too late, but this is exactly what I've been trying to work out.

Any chance of a capx or tutorial on how you managed to pull this off?

Any help would be appreciated.
B
7
S
1
Posts: 18
Reputation: 361

Post » Fri May 01, 2015 6:14 am

hey mattrix, i think i still have the old test capx i worked on, i can share it with you but i honestly have not looked at it in a long time.

what portions are you having trouble with. i can give you some help if you need it.

https://www.dropbox.com/s/8frhyhn7zhr13 ... .capx?dl=0

link to .capx

@mattrix
B
22
S
5
G
1
Posts: 81
Reputation: 2,271

Post » Sun Feb 21, 2016 3:54 am

Hi @BACLog, I feel like such a jerk. You responded within 2 hours of my asking you the question, but I never replied, because I never saw there was a response.

I've been away from Construct 2 for good while now, and only recently had the chance to get back into it. I've been struggling with the camera and was just about to make a post of my own when I found this post again with your answer.

This looks like exactly what I need. Thank you. I will probably have to make some adjustments to get it to fit my use, but this gives me a major helping hand (I went from "how do you do that?" to "oh, that's how you do it").

Time to have a play with it now.

Thank you again (I may love you just a little. shh... don't tell my wife)
B
7
S
1
Posts: 18
Reputation: 361

Post » Fri Sep 02, 2016 9:09 pm

@BACLog, thank you very very very much for your SmartCamera.capx! You solved my problem!! But I have a doubt: How can I put the player below the center of the screen (similar to Super Mario World)?
B
8
Posts: 8
Reputation: 339


Return to How do I....?

Who is online

Users browsing this forum: michaelverdi and 19 guests