I moved to a new URL! Check it out!

Dev Log: Some More Camera Stuff

Dev Log: Some More Camera Stuff
I'm feeling pretty exhausted today so this post will probably be pretty short. Last week I posted about working on some camera stuff for platforming in Flashpunk. I made a few adjustments to the way my camera worked based on some more stuff I observed from Mario World and Yoshi's Island.

Image

I changed around how some of the horizontal camera stuff works. Now you have some wiggle room before the camera starts to move at all horizontally. The look ahead also works slightly better than before. If you're pushing up against the side of the wiggle-area, the camera will slowly look ahead in the direction you're pushing. If you're moving in that direction, the speed in which it looks ahead increases so that you'll hopefully always be able to see what's coming down the line if you're moving fast.

The vertical movement is more or less the same. The camera only catches up to you when you're on a platform, or if you're pushing the margin of the screen with jumping or falling. The falling margin of the screen is much higher, since usually if you're falling you want to see a little bit downward. One thing I did change was the camera's natural target point in the y direction. Now if the camera thinks you're moving upward a lot, it will look above the player somewhat. If you're moving down though, it will look directly at the player again. Looking somewhat above the player ends up looking nice in most platformers because locking on in the center usually means showing 50% of the screen as solid ground with the most basic camera behavior.

I have run into some snags along the way... right now I need to figure out how to handle camera blocking better. Camera blockers are necessary for a game like this to hide secret areas, and I don't want to reveal them until the player actually crosses into the secret area. At the point in which the player crosses the blocker, the camera will then be unlocked and catch up to its target position again. This worked fine up until the point in which I made the player camera more complicated... I might have to do some tinkering to get it working just the way I want, but also in a clean and reusable way.

Okay that's all for now! (PS The Flashpunk website is still down, but once it comes back up all my links to it will work again! Also if you're looking for just the code, check out the Git repository.)

Comments

Nounverber
Nounverber
This may come to late but I found this video to be interesting/helpful.
http://www.youtube.com/watch?v=TCIMPYM0AQg

You may also want to consider spelunky-like camera controls, where you can move the camera up/down by holding the respective arrow keys (as long as you don't use them for other controls).
Posted March 4th 2013 8:03 PM
Kyle
Kyle
I actually posted that video in my previous blog post, and based a lot of this on the Mario World and Yoshi's Island camera! :)

Up and down looking controls are currently working, but I need to fix some issues with the camera pushing past camera boundaries when looking up and down.
Posted March 5th 2013 2:13 PM
Yuan Hao
Yuan Hao
Camera looks really nice -- I happened to be working on our own camera at the same time and took some inspiration from yours :)

One question, since it's hard to see it in the GIF because of the framerate, do you ever move less than one pixel per frame? For example, one pixel every two or three frames? I ended up doing that to make the camera feel smoothly, but I'm not sure if I'm happy with it.

Cheers~!
Posted March 9th 2013 12:02 AM
Kris
Kris
Yo Kyle, nice work !

All this stuff, is it implemented in Otter ?
Posted March 23rd 2014 5:58 AM
Kyle
Kyle
Whoaa this post is super old. None of this is by default implemented in Otter, but I might be able to port the Flashpunk code over to some sort of... PlatformingCamera component, maybe?
Posted March 26th 2014 1:03 AM
new comment!

Post your comment!

Name
Email
Comment