Restricting Worldmap Viewing Field

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 8:02 am

Image

I just finished the Worldmap of MH1.5's World 5, so since I used some abstract Methods to create it, I can't continue it outside of the
Playable Zone. Therefore I wondered if it would be possible to restrict the Players Viewing Field to the Worldmap "Box".

Thanks in Advance for any assistance.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 8:11 am

You can use camlock, defining the boundaries as an area at least 800x600 big to serve as the camera boundaries (independent of any overlays that further reduce the size of the viewport)

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 8:48 am

Enjl wrote:
Mon Dec 14, 2020 8:11 am
You can use camlock, defining the boundaries as an area at least 800x600 big to serve as the camera boundaries (independent of any overlays that further reduce the size of the viewport)
Ah, Okay.

Regarding Width and Height, what do I enter there?
The amount of Tiles from left to right/top to bottom?
(The Whole Map is of course only a single Tile in reality.)

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 8:58 am

DrMekar wrote:
Mon Dec 14, 2020 8:48 am
Enjl wrote:
Mon Dec 14, 2020 8:11 am
You can use camlock, defining the boundaries as an area at least 800x600 big to serve as the camera boundaries (independent of any overlays that further reduce the size of the viewport)
Ah, Okay.

Regarding Width and Height, what do I enter there?
The amount of Tiles from left to right/top to bottom?
(The Whole Map is of course only a single Tile in reality.)
Usually (like here, too), measurements for width and height are done in pixels. Width must at least be 800, and height must at least be 600, since that's the size of the camera. Camlock restricts the camera to a rectangle once the player is inside that rectangle, and the camera cannot fit into an area smaller than itself.

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 9:13 am

I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 10:28 am

DrMekar wrote:
Mon Dec 14, 2020 9:13 am
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)
Try putting 1 as the last argument.

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 10:40 am

Enjl wrote:
Mon Dec 14, 2020 10:28 am
DrMekar wrote:
Mon Dec 14, 2020 9:13 am
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)
Try putting 1 as the last argument.
I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 10:48 am

DrMekar wrote:
Mon Dec 14, 2020 10:40 am
Enjl wrote:
Mon Dec 14, 2020 10:28 am
DrMekar wrote:
Mon Dec 14, 2020 9:13 am
I did it, though Nothing changed. My Tile is 865x672, therefore it should work.

The Code:

Code: Select all

local camLock = API.load("camLock")
camLock.addZone(6208,-5792,865,672,0)
Try putting 1 as the last argument.
I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.
It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 10:56 am

Enjl wrote:
Mon Dec 14, 2020 10:48 am
DrMekar wrote:
Mon Dec 14, 2020 10:40 am
Enjl wrote:
Mon Dec 14, 2020 10:28 am


Try putting 1 as the last argument.
I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.
It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?
Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 10:58 am

DrMekar wrote:
Mon Dec 14, 2020 10:56 am
Enjl wrote:
Mon Dec 14, 2020 10:48 am
DrMekar wrote:
Mon Dec 14, 2020 10:40 am


I did. Still refuses to work. I also tried it with the Bottom, Top, Left and Right
Coordinates as an alternative with the same result.
It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?
Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.
Camlock is included in beta 4. The version posted to the forums may be outdated.

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 11:08 am

Enjl wrote:
Mon Dec 14, 2020 10:58 am
DrMekar wrote:
Mon Dec 14, 2020 10:56 am
Enjl wrote:
Mon Dec 14, 2020 10:48 am


It works for me, using the camlock from SMBX2 beta 4's installation.
Are 6208,-5792 the left and top edges of the box respectively?
Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.
Camlock is included in beta 4. The version posted to the forums may be outdated.
local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Okay, I used the included Version now, though still without results.
I did found this into camlock local vectr = require("vectr"), do I need
to name this in my lunaoverworld too?

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 11:13 am

DrMekar wrote:
Mon Dec 14, 2020 11:08 am
Enjl wrote:
Mon Dec 14, 2020 10:58 am
DrMekar wrote:
Mon Dec 14, 2020 10:56 am


Image
They are. I also have the newest Patch, Patch 3.
I was about to look it up on the PGE Wiki, but found your Libary, which is what I'm using.
Camlock is included in beta 4. The version posted to the forums may be outdated.
local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Okay, I used the included Version now, though still without results.
I did found this into camlock local vectr = require("vectr"), do I need
to name this in my lunaoverworld too?
No. Like I said, it works for me with the included one, so the problem here is probably elsewhere? If you can send me the necessary files, I can take a look.

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 11:19 am

Enjl wrote:
Mon Dec 14, 2020 11:13 am
DrMekar wrote:
Mon Dec 14, 2020 11:08 am
Enjl wrote:
Mon Dec 14, 2020 10:58 am

Camlock is included in beta 4. The version posted to the forums may be outdated.
local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Okay, I used the included Version now, though still without results.
I did found this into camlock local vectr = require("vectr"), do I need
to name this in my lunaoverworld too?
No. Like I said, it works for me with the included one, so the problem here is probably elsewhere? If you can send me the necessary files, I can take a look.
Okay. Here're the Files: https://www.mediafire.com/file/8249fsx4 ... s.zip/file

It includes my Worldmap File, My LuaOverworld and the Tile in Question, hope that's everything needed.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Restricting Worldmap Viewing Field

Postby Emral » Mon Dec 14, 2020 11:29 am

rename the lua file to map.lua and edit it like follows:

Code: Select all

for i=1, 36 do
	if i ~= 14 then
		local s = Graphics.loadImage("tile-" .. i .. ".png") --why does graphics.sprites not work for this...?
		if s then
			for k,v in pairs(Tile.get(i)) do
				v.width = s.width
				v.height = s.height
			end
		end
	end
end

local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)

DrMekar
Eerie
Eerie
Posts: 787
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Restricting Worldmap Viewing Field

Postby DrMekar » Mon Dec 14, 2020 11:35 am

Enjl wrote:
Mon Dec 14, 2020 11:29 am
rename the lua file to map.lua and edit it like follows:

Code: Select all

for i=1, 36 do
	if i ~= 14 then
		local s = Graphics.loadImage("tile-" .. i .. ".png") --why does graphics.sprites not work for this...?
		if s then
			for k,v in pairs(Tile.get(i)) do
				v.width = s.width
				v.height = s.height
			end
		end
	end
end

local camLock = require("camlock")
camLock.addZone(6208,-5792,862,672,1)
Thank You :).


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari