Smooth Camera Follow

Murad

  • Posts: 151
Hi, I'm requesting a behavior of a smooth Camera Follow. There used to be one on Stencyl at one point but was removed for some reason or another. I think it stopped working when Stencyl was converted to flash but I don't know exactly.
Essentially what the behavior does is have the camera follow the player in a smoother, more flowy look instead of always being dead center on the player actor. Notice in this video how the camera isn't always totally focused on the player. When he stops moving, the camera takes a moment to catch up because it sort of lags.

http://www.youtube.com/watch?v=Cr0CCkH49g0

Stencyl Ninja

  • Posts: 246
This should solve your problem.


Jon

  • *
  • Posts: 17523
Another approach is to have the camera follow an invisible, non-colliding actor and use the "slide" block on that actor to add the delay you desire. That's what the original smooth camera behavior did.

Stencyl Ninja

  • Posts: 246
I'm pretty new to Stencyl so don't even know of a sliding block yet, lol.
I've only just now realized that it looks like I posted nothing here unless you are logged in.

Yea mozzy, Jon's way is better, use his, cause I still don't have the whole easy alterability thing down ... mine's just a quick hard-coded method ... although that could be changed I guess once I get better at this.

Hey Jon, any ideas on a good way to start a Punch-Out Clone?
Thought I'd have it half done by now but never can get myself to start work on it.

irock

  • *
  • Posts: 2877
I've tried to replicate the Cave Story camera behavior in several different ways, but I failed each time.

If I recall correctly, the old smooth camera just replicate the player's movement at a delay. It wasn't actually smooth. If you hit a wall and stopped abruptly, the camera would stop instantly too. If you turn around instantly, the camera would too. Cave Story's is much more organic.

Regarding the use of a slide block for the camera, I thought sliding couldn't be interrupted. What if the player turns around?

Also, another neat thing Cave Story's camera does is it seamlessly moves a bit in front of the player so they can see what's ahead.

« Last Edit: December 06, 2011, 10:25:51 pm by Irock »

Stencyl Ninja

  • Posts: 246
@Irock: umm ... pretty sure my bit of code there does all that you mentioned actually.

I'll upload to StencylForge under ummm ... CaveStory Camera ...

Please let me know what the difference is and maybe I can find a way to improve it ... if someone who's used this nice Stencyl software for awhile could add some re-usability to it (where ya can change values) that'd be kewl too, cause I'm not quite to the point where I worry about anything past whether it works or not yet. Thanks.

Edit: Ok, it's now uploaded on the StencylForge under CaveStory Camera.
@Irock: please let me know what needs added to it to be more like CaveStory. Thanks.

« Last Edit: December 07, 2011, 01:46:24 am by Stencyl Ninja »

irock

  • *
  • Posts: 2877
Could you make a demo for it?

Stencyl Ninja

  • Posts: 246
What do you mean by demo? ... I put it on StencylForge so you can look at the code ... Did you want a tutorial explaining it?

It uses a number attribute that I named Alterable Value A (due to my fondness of the games factory) and adds or subtracts that value to get the camera location. I just limit how far it can move by using if not greater than and if not less than.

Also note that for some reason the left and right would not work so I used the attributes Left and Right instead. That may have been when I had something else wrong though, I don't know, I tend to trial and error alot to get anything decent to happen.

That's the basic gist of it anyway. I don't fully understand why it works exactly as it does or I'd make a tutorial. All these klik programs work a little bit different in how logic must be pieced together to get stuff to happen. While I may be skilled enough to get by in logic for logic's sake, I'm still very far off from being skilled in Stencyl.

Murad

  • Posts: 151
He means that when you upload the code onto forge, you have the option of attaching a game that uses the code to show people how it looks and works in game.

I haven't been able to look at it but I will as soon as I can.

I can't find it on forge

« Last Edit: December 07, 2011, 04:27:31 pm by mozzy »

irock

  • *
  • Posts: 2877
I'm talking about a game that showcases it so I don't have to close the game I'm working on, start a new one, download your behavior and apply it.

Stencyl Ninja

  • Posts: 246
Hmm ... thought I uploaded it as all that was in it, including the starter stuff others made like from the crash course ..... guess I had it set on behaviour or something when uploading? ... I'll look into it, sorry.

It's on StencylForge under games.
I just downloaded it and tested it.
It works fine for me guys, just search "cave story" it appeared at the bottom, there's no image for it, just a joystick.

« Last Edit: December 07, 2011, 10:57:16 pm by Stencyl Ninja »

Murad

  • Posts: 151
Its cool, but it's not quite what I had in mind. Maybe it will be different once you add the up and down panning as well.

Stencyl Ninja

  • Posts: 246
Well, what is it not doing that you want it to do?
Maybe I can work on it some more later.
Is it just the up and down panning that's missing?
Or is there something else it doesn't do that it should?

I could make big thick walls near the edges of the scene
so that the camera continues past the edges.
Is that a factor? ... Anything else you can think to add?

wohoo

  • Posts: 128
Any chance of something happening with this? Would love to have that CaveStory-like camera behavior.

Stencyl Ninja

  • Posts: 246
Well, I've expanded it a little past this already in a collaboration, but it's not exactly like
the Cave Story camera as I've never actually played the game.
From what I can tell in the videos, my version is now more functional for larger sprites than
CaveStory's but less 'organic' than CaveStory's ... less fluid ... I'll have to work on that.


I might switch out the graphics later on and update what's there, but it'll be awhile.
There's much I have to do and I'm an easily distracted person.
I've gotta force myself to focus. That would change pretty quick once I get to where I start
making money though as "a bird in the hand is worth 2 in the bush"
 (It's worth more than that in actuality but that's the old saying anyway).