Any way to make a level warp vertically?
Posted: 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?
Forums for SMBX
https://www.smbxgame.com/forums/
Then it's clearly not the best way, because the vertical wrap in Hypnosis Redo's intro level is s l i c k.Electriking wrote:The best way to make vertically wraping is to use instant warps although they don't really work very well.
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
endSomeone in codehaus needed vertical wrap recently so here's a more dynamic variant:HenryRichard wrote: ↑Tue Oct 09, 2018 8:40 pmThrow 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.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).Code: Select all
if player.y >= -140000 then --coords player.y = -140632 end if player.y <= -140638 then player.y = -140004 end
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