"Look Ahead" camera movement

This forum is currently in read-only mode.
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • I made a new camera behavior for platformers - in which the camera pans to the direction that your character is facing/moving, to emulate a "looking ahead" kind of effect. The camera pans back to center on the character while he/she/it is not moving.

    This is similar to the camera behavior in cave story, not exactly the same, but pretty similar. The values are easily tweaked for scrolling speed and re-centering and distance to look ahead, just rummage through the two groups "Look ahead" and "Center View" - it should become obvious to you.

    I'm sure there are probably a lot better ways to do this, but I just started using construct a week ago so cut me some slack XD

    Look ahead camera effect

    Version that Lucid worked up for me, for those who are interested in getting a similar effect without using any plugins; or if you just like math lol.

    Look ahead example by Lucid

    I also have one that lucid made for me without using MagiCam plugin that may be a little bit better but a lot harder to understand than this one; but since I didn't make it myself I don't want to post it up here without his permission, even though I'm pretty sure he wouldn't care. I'll ask him next time I see him.

  • One easy way to make the camera pan ahead towards where the player is facing (just like cave story)-- without even using any math is to set the magicam to follow an invisible sprite which is always set to the proper X co-ordinates in relationship to the player sprite.

  • One easy way to make the camera pan ahead towards where the player is facing (just like cave story)-- without even using any math is to set the magicam to follow an invisible sprite which is always set to the proper X co-ordinates in relationship to the player sprite.

    If I understand you correctly - That wouldn't be smooth enough, it would "snap" to that location

  • There's really no need for dummy objects. You can get away with just using variables.

    +>system compare global value global.value("view") = "ahead"

    ->player compare .angle = 0

    -->system set scroll x to lerp(scroll.x, player.x+offset, 1-0.5^timedelta)

    ->player compare .angle = 180

    -->system set scroll x to lerp(scroll.x, player.x-offset, 1-0.5^timedelta)

    +>system compare global value global.value("view") = "center"

    ->system set scroll x to lerp(scroll.x, player.x, 1-0.5^timedelta)

    For sideview, topdown would add angles, y axis etc.

  • Offtopic but...

    Newt, your new avatar gives me the creeps O.o

  • Feel free to post that or use it, wgrace.

  • There's really no need for dummy objects. You can get away with just using variables.

    +>system compare global value global.value("view") = "ahead"

    ->player compare .angle = 0

    -->system set scroll x to lerp(scroll.x, player.x+offset, 1-0.5^timedelta)

    ->player compare .angle = 180

    -->system set scroll x to lerp(scroll.x, player.x-offset, 1-0.5^timedelta)

    +>system compare global value global.value("view") = "center"

    ->system set scroll x to lerp(scroll.x, player.x, 1-0.5^timedelta)

    For sideview, topdown would add angles, y axis etc.

    Thats good code, it feels a little too mechanical for my tastes though - even after tweaking the values, maybe a little too complicated to get the little "nuances" I get from having a dummy object too. Like how the scroll speed increases a bit when you change directions, to make up for not starting at a centered view, also the little extra push the camera gets when your character runs into a wall.

    Its kinda hard to keep it consistent too - if my characters run speed ever increases (dashing) - he starts "catching up" to the camera. It's wayyyy easier to implement subtle changes with the camera object I think. It feels more "alive" too in my opinion..

    Though your method definitely displays a lot more technical skill than mine lol.

    This is the version that Lucid worked up for me for those who don't have or don't want to use magicam. Or just like math lol. [Thank you to lucid]

    Look ahead example by lucid

  • Sorry for excavating threads, I was looking for that camera equation i seen looong time ago, I just remember there was some lerp involved in lucid's one, but no idea what it was...

    It seems both links are dead, does someone still have those?

  • sved

    Maybe too late but I found this not long ago.

    lerp(.X, player.X, 1 - 0.001^TimeDelta)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's not too late, but I cant make it work. Seems Timedelta is not recognised as well. I'll try a bit more before opening a proper help topic for that.

    Thanks!

  • I found back the .cap from long time ago, but I have no idea how to set the private variable

    <img src="https://dl.dropboxusercontent.com/u/61894646/lerp%20variable.JPG" border="0" />

    It always tells me "unknown expression 'offset': this is not a system expression or variable name in this scope). I checked the manual but it justs shows the function as lerp(a,b,x)... I tried "offset", 'offset', offset, offset.value and other I could think of... no success

    Below the old cap, any help is welcome!

    dl.dropboxusercontent.com/u/61894646/oldcam.cap

  • Oops, I just realised this topic is still in the Construct Classic area, I'm basically trying to do this effect in C2.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)