customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Share and discuss custom LunaLua code and content packs for SMBX2.
MrDoubleA
Flurry
Flurry
Posts: 385
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby MrDoubleA » Sun Mar 20, 2022 6:48 pm

Hey! Made this over a few days. Adds two sizeables (called controllers and blockers) that let you control the camera/screen itself, including targetting NPC's, zooming in/out, and cropping the screen. Its controls are also available as options in the library itself if you don't want to use the controllers.

(As mentioned in the controller extra settings, certain things like NPC's with custom rendering won't work properly with zooming out. If you want to fix this, you can use some of the "register draw" functions mentioned near the top of the lua file, but I may add more compatibility for NPC's over time.)

Screenshots: show
(Note: these sizeables are invisible in-game and are only shown here for demonstration/testing.)
Image
Image
Image
Image

Note about Handycam: show
This library should be partially compatible with handycam.lua, but if you have some zoom with it by default and want to use this library, you should change code like this:

Code: Select all

local handycam = require("handycam")

handycam[1].zoom = 1.5
To:

Code: Select all

local customCamera = require("customCamera")

customCamera.defaultZoom = 1.5

Download!

FutureNyanCat
Rocky Wrench
Rocky Wrench
Posts: 696
Joined: Fri Dec 20, 2013 8:39 pm
Flair: Species: Felis robotus
Pronouns: He/Him
Contact:

Re: customCamera.lua - Actual Camera Control Stuff

Postby FutureNyanCat » Sun Mar 20, 2022 7:34 pm

Ayo it's finally out. I might get around to using this for cutscenes with the layer-event system.

Mal8rk
Snifit
Snifit
Posts: 200
Joined: Mon Oct 25, 2021 11:04 pm
Flair: English Speaking Spanish Speaker
Pronouns: He/Him
Contact:

Re: customCamera.lua - Actual Camera Control Stuff

Postby Mal8rk » Sun Mar 20, 2022 9:35 pm

This is hella awesome!

but an example level would be a nice touch

AirShip
Panser
Panser
Posts: 1063
Joined: Wed Jan 01, 2014 1:30 am
Flair: The Flying Ghost
Contact:

Re: customCamera.lua - Actual Camera Control Stuff

Postby AirShip » Sun Mar 20, 2022 11:54 pm

Awesome work MrDoubleA, one more must-necessary lua for my collection, good job!

LooKiCH
Tweeter
Tweeter
Posts: 159
Joined: Tue Jun 13, 2017 11:28 am
Pronouns: he/him
Contact:

Re: customCamera.lua - Actual Camera Control Stuff

Postby LooKiCH » Mon Mar 21, 2022 2:08 am

I hope there is no bug with item box

Master of Disaster
Rex
Rex
Posts: 35
Joined: Sun Nov 28, 2021 9:29 am
Flair: Average Koopa Fan
Pronouns: he/him

Re: customCamera.lua - Actual Camera Control Stuff

Postby Master of Disaster » Mon Mar 21, 2022 11:26 am

I noticed some small things with this pack:
First, the controller areas have a bottom collision. Thus it isn't possible to jump into a camera control area from below
Second, the reserve item Box doesn't release its content at the right spot when camera offset (X and/or Y) is active. Although this doesn't have to be changed as it is a minor gripe that doesn't affect gameplay in a bad way.
The bottom collision though should get adressed though.

Really liking this system so far, it gives the builder much more agency and works extremely fluently, good job!

MrDoubleA
Flurry
Flurry
Posts: 385
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby MrDoubleA » Tue Mar 22, 2022 5:29 pm

Small update. Change log:
- The camera will now be properly reset after going through a pipe to the same section that you're already in.
- For drawScene (i.e., zooming out), fixed sizeable rendering.
- For drawScene, BGO's will no longer render while hidden.
- For drawScene, added special support for the launch barrel NPC's.

Also, not a change, but I just want to point out that customCamera.drawScene can just be used outside of any actual camera stuff, if you find that useful for your own code.

JamesR624
Spiny
Spiny
Posts: 29
Joined: Wed Aug 09, 2017 4:24 pm

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby JamesR624 » Fri Jun 10, 2022 10:09 am

This is really awesome!
however, I did notice that this doesn't seem to have any support for player 2.

I sadly have noticed that nearly ALL scripts on this site like shaders or camera functions, never seem to take into account 2 players. How come? It's a core mechanic of the game.

deice
Volcano Lotus
Volcano Lotus
Posts: 541
Joined: Fri Jul 23, 2021 7:35 am

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby deice » Fri Jun 10, 2022 10:28 am

JamesR624 wrote:
Fri Jun 10, 2022 10:09 am
I sadly have noticed that nearly ALL scripts on this site like shaders or camera functions, never seem to take into account 2 players. How come? It's a core mechanic of the game.
there's probably a lot of things that contribute to this, but to name a few:

- scripts that account for more than one player are harder to code and much harder to test
- a lot of recent episodes don't allow for two players (iirc even the default launcher template has two player mode disabled) so scripts that people make for their episodes and then publish are less likely to do so, and there's less of a target audience
- very very few people use two player mode, so even if the script is meant to work with two players, it's unlikely that someone will notice when it doesn't

there's probably other things too, but these are the first few that come to mind.

JamesR624
Spiny
Spiny
Posts: 29
Joined: Wed Aug 09, 2017 4:24 pm

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby JamesR624 » Fri Jun 10, 2022 10:54 am

Ahh, thank you for the clarifaction.

Well, I'll admit that 2 player co-op does also make it harder to make levels that account for all that.

I realize that this may be slightly off topic but I have been searching and cannot seem to find this. I was curious if there was a way to have the character switch between Mario & Luigi upon death? I was hoping to make a '2-player mode', that is just swapping out the two players each death instead of co-op. This would make level making easier but also make it so all shaders and scripts can work fine without needing to take into account the co-op, as you said.

My first place to look was the scripting for the player blocks and just have that trigger upon death but I cannot seem to find a way to do that so I was just curious if I am missing something.

deice
Volcano Lotus
Volcano Lotus
Posts: 541
Joined: Fri Jul 23, 2021 7:35 am

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby deice » Fri Jun 10, 2022 12:36 pm

JamesR624 wrote:
Fri Jun 10, 2022 10:54 am
I realize that this may be slightly off topic but I have been searching and cannot seem to find this. I was curious if there was a way to have the character switch between Mario & Luigi upon death?
i've sent you a pm so as to avoid clogging the thread up with off-topic discussion.

FutureNyanCat
Rocky Wrench
Rocky Wrench
Posts: 696
Joined: Fri Dec 20, 2013 8:39 pm
Flair: Species: Felis robotus
Pronouns: He/Him
Contact:

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby FutureNyanCat » Fri Nov 11, 2022 2:14 am

Finally convinced myself to use this to showcase some setups in case they go off-screen. Very useful camera controls!

Pixelated_Perfection
Bob-Omb
Bob-Omb
Posts: 21
Joined: Fri Feb 25, 2022 1:23 pm
Pronouns: He/They

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby Pixelated_Perfection » Wed Jan 11, 2023 6:54 pm

I know this is a bit late but I recently found that using darkness and lighting combined with this script has a funny little result.
(Ignore how blocky everything looks zoomed out thats from retroResolution)
Image

Im not sure what to do about this but maybe thats something to look into for future updates to the script?

MrDoubleA
Flurry
Flurry
Posts: 385
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby MrDoubleA » Sun Jan 29, 2023 12:59 pm

Pixelated_Perfection wrote:
Wed Jan 11, 2023 6:54 pm
I know this is a bit late but I recently found that using darkness and lighting combined with this script has a funny little result.
(Ignore how blocky everything looks zoomed out thats from retroResolution)
Image

Im not sure what to do about this but maybe thats something to look into for future updates to the script?
This unfortunately isn't really fixable (or would be harder to fix than it's worth). Zooming out requires re-rendering the level, which excludes any darkness.

Pixelated_Perfection
Bob-Omb
Bob-Omb
Posts: 21
Joined: Fri Feb 25, 2022 1:23 pm
Pronouns: He/They

Re: customCamera.lua (v1.0.1) - Actual Camera Control Stuff

Postby Pixelated_Perfection » Sun Jan 29, 2023 2:11 pm

MrDoubleA wrote:
Sun Jan 29, 2023 12:59 pm
Pixelated_Perfection wrote:
Wed Jan 11, 2023 6:54 pm
I know this is a bit late but I recently found that using darkness and lighting combined with this script has a funny little result.
(Ignore how blocky everything looks zoomed out thats from retroResolution)
Image

Im not sure what to do about this but maybe thats something to look into for future updates to the script?
This unfortunately isn't really fixable (or would be harder to fix than it's worth). Zooming out requires re-rendering the level, which excludes any darkness.
ah, makes sense, well i had to ask, thanks for the response!


Return to “LunaLua”

Who is online

Users browsing this forum: Spudly and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari