Mario-Style Camera

For questions about using Classic.

Post » Mon Feb 15, 2010 8:10 pm

I'm trying to achieve a great camera for my 2D platformer and I'm using Mario games as my model of how it should work. It looks like it would be good to have the camera follow the player along X, but Y should only be scrolled if the player is jumping past a certain height on the screen, such as when you land on a platform close to the top of the screen or like in mario when you use a cape or something and fly way above the level. If Y scrolls all the time, it doesn't look very good and feels too jumpy with too much motion going on. This might be a little hard to explain, so I'll use a video and article:

[url:2gsn5lyw]http://www.youtube.com/watch?v=2SfvhZgD7Bk[/url:2gsn5lyw]

[url:2gsn5lyw]http://replicaisland.blogspot.com/2010/01/elusive-perfect-platformer-camera.html[/url:2gsn5lyw] (this article has the video embedded as well if you want to go straight to this)

I've tried all sorts of complex things involving the Advanced Camera Plugin. My most recent attempt was to try to use a "window" method like is mentioned in the linked article. In theory, when the player pushes up against a box around him, the window scrolls appropiately, otherwise it stays still. I did this by putting a Box at the top of the screen, (there would be one at the bottom as well) then using a couple cameras and camera switching and multiple layers with sprites and things, but it gets confusing and still won't work right.

If anyone knows how to get this to work (a camera system like in SMB3 or SMW), it would be an amazing accomplishment and immensely appreciated.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Tue Feb 16, 2010 3:10 am

Sounds like something useful I could add to the Advanced Camera plugin. I'll see if I can get around to that. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Tue Feb 16, 2010 12:48 pm

I was thinking of trying to implement something like this earlier in my game as I also didn't like it always scrolling... I failed miserably, so it's nice your considering to add it in your plugin Linkman!
B
2
S
2
G
3
Posts: 143
Reputation: 1,536

Post » Tue Feb 16, 2010 7:19 pm

sweet, Linkman!

let us define a box within which there is no scrolling and the box that marks the maximum scroll speed, since some games might be off-center (think diablo with the inventory screen open).
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Feb 16, 2010 8:13 pm

That would be awesome!

Then the player could move a few steps in a direction (or a lot) without scrolling, then when he runs into the side of the box, the camera moves to center on him. It could then keep him in the center of the screen the whole time he is running, then when he stops or changes direction, the box is reset with him in the center so he can take a few steps in a direction again before the camera moves. If it just scrolled as he pushed against the box edges without moving to center on him, he might not have enough field of view in the direction he was running.

That would be one amazing camera for all sorts of games :D
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Thu Feb 18, 2010 2:18 am

Done(for the most part).

You can supply margins which dictate when the camera scrolls now, but the camera won't center on the object upon scrolling, and I'm not sure at this point if that will make it in.

As it is, the code for this plugin is crap since I was still new to programming at the time. Adding a feature like that just adds more complexity to an already unstable mess. I'll see what can be done, though.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests