UPDATE CONTENT:
- Spoiler
- Fixed some fatal bugs like background displaying incompletely.
Add a parameter which can customize the stretch multiple of the bgo when the screen is scrolling vertically. Set it to 0 to disable the stretch of the bgo.
- Spoiler
Code: Select all
script pseudo3dbg(id as integer, sid as integer, picid as integer, width as integer, height as integer, split as integer, maxi as double, mini as double, stretch as double, type as integer, parax as double, paray as double, xsp as double, z as double, color as double)
Dim i as integer
dim x as integer
Dim s as integer
dim t as double
dim ty as double
dim ty2 as double
Dim num as integer = -int(-800/width)/(2*(mini+i*(maxi-mini)/(height/split)))
for s = sid to sid
for i = 0 to height/split - 1
for x = -num to num
If char(1).section = sid Then
If i <> 0 Then
If type = 1 Then
call BmpCreate(id*1000000000+ i*10000 + x, picid, 0, 1, 0, i*split, width, split, sysval(player1scrX), sysval(player1scrY) + 600*type + height*2*(0.5-type) + i*split, 2*(mini+i*(maxi-mini)/(height/split)), 1, 0, 0, 0, color)
Else
call BmpCreate(id*1000000000+ i*10000 + x, picid, 0, 1, 0, height-i*split, width, split, sysval(player1scrX), sysval(player1scrY) + 600*type + height*2*(0.5-type) + i*split, 2*(mini+i*(maxi-mini)/(height/split)), 1, 0, 0, 0, color)
End If
Else
call BmpCreate(id*1000000000+ i*10000 + x, picid, 0, 1, 0, 0, width, height, sysval(player1scrX), sysval(player1scrY) + 600*type + height*2*(0.5-type) + i*split, 2*(mini+i*(maxi-mini)/(height/split)), 1, 0, 0, 0, color)
End If
Else
Call berase(2,sid*1000000000+ id*100000000 +i*10000 + x)
End If
t = parax*(section(sid).x + xsp*sysval(gametime) - sysval(player1scrX))/32 - width*2*(((section(sid).x + xsp*sysval(gametime) - sysval(player1scrX))*parax/32)\width*2 - 1)
ty = paray*(section(sid).y + section(sid).height*type - sysval(player1scrY) - 600*type)/32
If i <> 0 Then
bitmap(id*1000000000+ i*10000 + x).scaley = 1+ty*stretch
If bitmap(id*1000000000+ i*10000 + x).scaley >= split*2/stretch Then
bitmap(id*1000000000+ i*10000 + x).scaley = split*2/stretch
End If
End If
bitmap(id*1000000000+ i*10000 + x).zpos = z-i*0.0001
bitmap(id*1000000000+ i*10000 + x).destx = sysval(player1scrX) + 400 - (width-1)/2*2*(mini+i*(maxi-mini)/(height/split)) + (width-1)*2*(mini+i*(maxi-mini)/(height/split))*x + t*(mini+i*(maxi-mini)/(height/split))
If i <> 0 Then
bitmap(id*1000000000+ i*10000 + x).desty = sysval(player1scrY) + (600 - height)*type - 2*(0.5-type)*i*split + height*(1-type) - 4*stretch*(0.5-type)*ty*(mini+i*(maxi-mini)/(height/split))- 2*(0.5-type)*split
Else
If type = 1 Then
bitmap(id*1000000000+ i*10000 + x).desty = sysval(player1scrY) + (600 - height)*type + 1*split + 2*stretch*ty*(mini+1*(maxi-mini)/(height/split))
Else
bitmap(id*1000000000+ i*10000 + x).desty = sysval(player1scrY) + (600 - height)*type - 2*(0.5-type)*1*split - 4*stretch*(0.5-type)*ty*(mini+1*(maxi-mini)/(height/split))
End If
End If
next
next
next
end script
'split - this determines the split height of the gfx, the smaller this number is, the more refined the bgo is
'maxi - this determines the maximum zoom multiple of the gfx
'mini - this determines the minimum zoom multiple of the gfx
'stretch - this determines the stretch multiple of the gfx when the screen is scrolling vertically, set it to 0 to disable the stretch of the gfx
'type - 1 for glue sth to the floor of the section, 0 for glue sth to the ceiling of the section
'parax - this determines how fast gfx is scrolling when player moves screen horizontally
'paray - this determines how fast gfx is scrolling when player moves screen vertically
'Credit by HengShao, referenced from Yvahnek's Parallax BGO script
'Example:
'Call pseudo3dbg(1,1,1,64,64,1,1.5,0.5,0.5,1,16,8,0.15,0.99,-1)
'(It should in do loop)
Preview GIFs:
- Spoiler



- Spoiler
- Only compatible with 1.4.5.
It can't support GFX with transparent background at present.
BGO may become buggy if the section is too long or the split height of the GFX is too small. To solve this, make the split height bigger or change the ID of bitmap to prevent other bitmaps' ID become coincide with it. (For example: bitmap(sid*1000000000+ id*100000000 + i*10000 + x) changes to bitmap(sid*100000000000+ id*10000000000 + i*10000 + x).)
If the section is too long or the split height of the GFX is too small, the game may lose frames. Take the computer configuration of you and players into account when using this script.
- Spoiler
- HengShao - for making this script
Yvahnek - for I referencing his Parallax BGO script
Slash-18 - for I using his rainbow effect script for the example bgos

