Any way to make a level warp vertically?

Need help with any SMBX game-related issues? Ask your questions here.
Oshi
Rip Van Fish
Rip Van Fish
Posts: 1223
Joined: Sun Aug 16, 2015 12:34 pm
Flair: ==> cool text! <==
Pronouns: he/him

Any way to make a level warp vertically?

Postby Oshi » Sun Sep 03, 2017 7:27 pm

There's on option for it in the PGE editor in 2.0 Beta3, but it's grayed out and unselectable. How do are you supposed to make it selectable?

HenryRichard
Birdo
Birdo
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Any way to make a level warp vertically?

Postby HenryRichard » Sun Sep 03, 2017 11:24 pm

You can't currently. You'll have to do it with Lua.

Julia Pseudo
Ludwig
Ludwig
Posts: 5603
Joined: Wed Jan 08, 2014 12:04 am
Flair: gay gaymer girl
Pronouns: She/her

Re: Any way to make a level warp vertically?

Postby Julia Pseudo » Mon Sep 04, 2017 12:08 am

Grayed out PGE options indicate that they're features of the (currently in Alpha) PGE engine, separate from SMBX I believe. As HenryRichard said, you'll have to use Lua if you want to implement this in SMBX.

ElectriKong
Posts: 4646
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Pronouns: he/him
Contact:

Re: Any way to make a level warp vertically?

Postby ElectriKong » Mon Sep 04, 2017 2:07 am

The greyed out features will likely be available in the future (either in a future version of 2.0 or when PGE is fully released and replaces SMBX).

The best way to make vertically wraping is to use instant warps although they don't really work very well.

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

Re: Any way to make a level warp vertically?

Postby The0x539 » Mon Sep 04, 2017 9:58 am

Electriking wrote:The best way to make vertically wraping is to use instant warps although they don't really work very well.
Then it's clearly not the best way, because the vertical wrap in Hypnosis Redo's intro level is s l i c k.

ClapClop
Goomba
Goomba
Posts: 1
Joined: Tue Oct 09, 2018 6:14 pm
Contact:

Re: Any way to make a level warp vertically?

Postby ClapClop » Tue Oct 09, 2018 6:21 pm

HenryRichard wrote:
Sun Sep 03, 2017 11:24 pm
You can't currently. You'll have to do it with Lua.
I did not understand, how I use lua to be able to use the warp vertically

HenryRichard
Birdo
Birdo
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Any way to make a level warp vertically?

Postby HenryRichard » Tue Oct 09, 2018 8:40 pm

ClapClop wrote:
Tue Oct 09, 2018 6:21 pm
HenryRichard wrote:
Sun Sep 03, 2017 11:24 pm
You can't currently. You'll have to do it with Lua.
I did not understand, how I use lua to be able to use the warp vertically
Throw something like this in your onTick() function. You'll have to change the coordinates to match your section's, and probably limit it to the current section as well.

Code: Select all

if player.y >= -140000 then --coords
			player.y = -140632
		end
		if player.y <= -140638 then
			player.y = -140004
		end
This code is from Hypnosis Redo - I don't know if Enjl wants credit for this or not (more likely than not he doesn't care, but I'd be on the safe side).

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Any way to make a level warp vertically?

Postby Enjl » Wed Oct 10, 2018 1:06 am

HenryRichard wrote:
Tue Oct 09, 2018 8:40 pm
ClapClop wrote:
Tue Oct 09, 2018 6:21 pm
HenryRichard wrote:
Sun Sep 03, 2017 11:24 pm
You can't currently. You'll have to do it with Lua.
I did not understand, how I use lua to be able to use the warp vertically
Throw something like this in your onTick() function. You'll have to change the coordinates to match your section's, and probably limit it to the current section as well.

Code: Select all

if player.y >= -140000 then --coords
			player.y = -140632
		end
		if player.y <= -140638 then
			player.y = -140004
		end
This code is from Hypnosis Redo - I don't know if Enjl wants credit for this or not (more likely than not he doesn't care, but I'd be on the safe side).
Someone in codehaus needed vertical wrap recently so here's a more dynamic variant:

Code: Select all

local _scrollSections = {0, 1, 2}

local scrollSectionMap = {}

for k,v in ipairs(scrollSections) do
    scrollSectionMap[v] = true
end

local allNPCIDs = {}
for i=1, 300 do
    allNPCIDs[i] = i
end

function onTickEnd()

    local checkedNPCSections = {}
    for _,p in ipairs(Player.get()) do
        if scrollSectionMap[p.section] then
            local s = Section(p.section)
            local b = s.boundary
	    local sheight = b.bottom - b.top + 32
            if p.y > b.bottom + 16 then
                p.y = p.y - sheight
            elseif p.y + p.height < b.top - 16 then
                p.y = p.y + sheight
            end
            if not checkedNPCSections[p.section] then
                for k,v in ipairs(NPC.get(allNPCIDs, p.section)) do
                    if v:mem(0x12A, FIELD_WORD) > 0 then
                        if v.y > v.bottom + 16 then
                            v.y = v.y - sheight
                        elseif v.y + v.height < v.top - 16 then
                            v.y = v.y + sheight
                        end
                    end
                end
            end
            checkedNPCSections[p.section] = true
        end
    end
end
Just adjust scrollSections with the section numbers you want to scroll. Remember that section numbers are 0-indexed so Section 1 in the editor is Section 0 in game.

No credit needed.


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 1 guest