Here you go:
Main Code:
set display mode 1024,768,32:hide mouse
dim cubes#(25,3):dim map(4,4):dim maprev(4,4):dim side(6):dim portalsize#(6):dim titlebounce(5,2):dim lev(1)
for t = 1 to 4:portalsize#(t)=t*25:next t
#include "functions.dba"
#include "move.dba"
title()
lev(1)=1
nextlevel:
if lev=3 then end
ink rgb(255,255,255),rgb(128,0,128):cls
load image "loading.jpg",30:paste image 30,362,200
level(lev(1))
delete image 30
sync rate 35:color backdrop rgb(100,0,100):backdrop on:sync on:do
round()
suckcube(suckcheck())
if upkey()=1 and movepossible(1)=1 then map(cubes#(1,1),cubes#(1,3)=0:movecube(1):posallcubes():round():map(cubes#(1,1),cubes#(1,3)=1
if rightkey()=1 and movepossible(2)=1 then map(cubes#(1,1),cubes#(1,3)=0:movecube(2):posallcubes():round():map(cubes#(1,1),cubes#(1,3)=1
if downkey()=1 and movepossible(3)=1 then map(cubes#(1,1),cubes#(1,3)=0:movecube(3):posallcubes():round():map(cubes#(1,1),cubes#(1,3)=1
if leftkey()=1 and movepossible(4)=1 then map(cubes#(1,1),cubes#(1,3)=0:movecube(4):posallcubes():round():map(cubes#(1,1),cubes#(1,3)=1
if spacekey()=1 then stick()
if controlkey()=1 then unstickall()
camera():posallcubes():portals()
if levelcomplete()=1 then leveldone():lev(1)=lev(1)+1:goto nextlevel
sync:loop
Movement Function:
rem >>>>>>>>> Move the player in a certain direction <<<<<<<<<<<
function movecube(Direction)
if Direction=1
a#=0
round()
x=cubes#(1,1):z=cubes#(1,3)
repeat
portals()
cubes#(1,3)=cubes#(1,3)+0.1
if a#<45 then cubes#(1,2)=cubes#(1,2)+0.1
a#=a#+9
if a#>45 then cubes#(1,2)=cubes#(1,2)-0.1
xrotate object 1,a#:xrotate object 1+1000,a#:poscube(1):camera()
sync
until a#=90
reset(1)
for t=1 to 6
if side(t)>0 then unglue object side(t):reset(side(t)):stickorig(side(t))
next t
if side(1)>0 then map(x,z-1)=0:map(x,z+2)=2:position(side(1),0,0,1):side(2)=side(1):side(1)=0
if side(5)>0 then map(x,z-1)=0:position(side(5),0,1,0):side(1)=side(5):side(5)=0
if side(3)=0 then goto 61999
if side(3)>0 then map(x+1,z-1)=0:map(x+1,z)=2
61999:
if side(4)>0 then map(x-1,z-1)=0:map(x-1,z)=2
endif
if Direction=2
a#=360
repeat
portals()
cubes#(1,1)=cubes#(1,1)+0.1
if a#>315 then cubes#(1,2)=cubes#(1,2)+0.1
a#=a#-9:a#=wrapvalue(a#)
if a#<315 then cubes#(1,2)=cubes#(1,2)-0.1
zrotate object 1,a#:zrotate object 1+1000,a#:poscube(1):camera()
sync
until a#=270
reset(1)
for t=1 to 6
if side(t)>0 then unglue object side(t):reset(side(t)):stickorig(side(t))
next t
if side(1)>0 then position(side(1),1,0,0):side(3)=side(1):side(1)=0
if side(4)>0 then position(side(4),0,1,0):side(1)=side(4):side(4)=0
endif
if Direction=3
a#=360
repeat
portals()
cubes#(1,3)=cubes#(1,3)-0.1
if a#>315 then cubes#(1,2)=cubes#(1,2)+0.1
a#=a#-9:a#=wrapvalue(a#)
if a#<315 then cubes#(1,2)=cubes#(1,2)-0.1
xrotate object 1,a#:xrotate object 1+1000,a#:poscube(1):camera()
sync
until a#=270
reset(1)
for t=1 to 6
if side(t)>0 then unglue object side(t):reset(side(t)):stickorig(side(t))
next t
if side(1)>0 then position(side(1),0,0,-1):side(5)=side(1):side(1)=0
if side(2)>0 then position(side(2),0,1,0):side(1)=side(2):side(2)=0
endif
if Direction=4
a#=0
repeat
portals()
cubes#(1,1)=cubes#(1,1)-0.1
if a#<45 then cubes#(1,2)=cubes#(1,2)+0.1
a#=a#+9
if a#>45 then cubes#(1,2)=cubes#(1,2)-0.1
zrotate object 1,a#:zrotate object 1+1000,a#:poscube(1):camera()
sync
until a#=90
reset(1)
for t=1 to 6
if side(t)>0 then unglue object side(t):reset(side(t)):stickorig(side(t))
next t
if side(1)>0 then position(side(1),-1,0,0):side(4)=side(1):side(1)=0
if side(3)>0 then position(side(3),0,1,0):side(1)=side(3):side(3)=0
endif
endfunction
Other Functions:
rem >>>>>>>>> Check if the player can move in a certain direction <<<<<<<<<
function movepossible(Direction)
value=1
if direction=1
if cubes#(1,3)>3 then value=0:goto moveend
if side(2)>0 then value=0:goto moveend
if cubes#(1,3)<4 and map(cubes#(1,1),cubes#(1,3)+1)>0 then value=0:goto moveend
if cubes#(1,1)>3.5 or cubes#(1,3)>3.5 then goto 42142
if map(cubes#(1,1)+1,cubes#(1,3)+1)*side(3)>0 and map(cubes#(1,1)+1,cubes#(1,3)+1)<4 then value=0:goto moveend
42142:
if cubes#(1,1)<1.5 or cubes#(1,3)>3.5 then goto 56276
if map(cubes#(1,1)-1,cubes#(1,3)+1)*side(4)>0 and map(cubes#(1,1)-1,cubes#(1,3)+1)<4 then value=0:goto moveend
56276:
if cubes#(1,3)>2.5 then goto 58241
if map(cubes#(1,1),cubes#(1,3)+2)>0 and map(cubes#(1,1),cubes#(1,3)+2)<4 and side(1)>0 then value=0
58241:
if cubes#(1,3)=3 and side(1)>0 then value=0
moveend:
endif
if direction=2
if cubes#(1,1)>3 then value=0:goto moveend2
if side(3)>0 then value=0:goto moveend2
if cubes#(1,1)<4 and map(cubes#(1,1)+1,cubes#(1,3))>0 then value=0:goto moveend2
if cubes#(1,1)>3.5 or cubes#(1,3)>3.5 then goto 85463
if map(cubes#(1,1)+1,cubes#(1,3)+1)*side(2)>0 and map(cubes#(1,1)+1,cubes#(1,3)+1)<4 then value=0:goto moveend2
85463:
if cubes#(1,1)>3.5 or cubes#(1,3)<1.5 then goto 17433
if map(cubes#(1,1)+1,cubes#(1,3)-1)*side(5)>0 and map(cubes#(1,1)+1,cubes#(1,3)-1)<4 then value=0:goto moveend2
17433:
if cubes#(1,1)>2.5 then goto 55247
if map(cubes#(1,1)+2,cubes#(1,3))>0 and map(cubes#(1,1)+2,cubes#(1,3))<4 and side(1)>0 then value=0
55247:
if cubes#(1,1)=3 and side(1)>0 then value=0
moveend2:
endif
if direction=3
if cubes#(1,3)<1 then value=0:goto moveend3
if side(5)>0 then value=0:goto moveend3
if cubes#(1,3)>0 and map(cubes#(1,1),cubes#(1,3)-1)>0 then value=0:goto moveend3
if cubes#(1,1)>3.5 or cubes#(1,3)<1.5 then goto 62891
if map(cubes#(1,1)+1,cubes#(1,3)-1)*side(3)>0 and map(cubes#(1,1)+1,cubes#(1,3)-1)<4 then value=0:goto moveend3
62891:
if cubes#(1,1)<1.5 or cubes#(1,3)<1.5 then goto 21734
if map(cubes#(1,1)-1,cubes#(1,3)-1)*side(4)>0 and map(cubes#(1,1)-1,cubes#(1,3)-1)<4 then value=0:goto moveend3
21734:
if cubes#(1,3)<1.5 then goto 41125
if map(cubes#(1,1),cubes#(1,3)-2)>0 and map(cubes#(1,1),cubes#(1,3)-2)<4 and side(1)>0 then value=0
41125:
if cubes#(1,3)=1 and side(1)>0 then value=0
moveend3:
endif
if direction=4
if cubes#(1,1)<1 then value=0:goto moveend4
if side(4)>0 then value=0:goto moveend4
if cubes#(1,1)>0 and map(cubes#(1,1)-1,cubes#(1,3))>0 then value=0:goto moveend4
if cubes#(1,1)<1.5 or cubes#(1,3)>3.5 then goto 99315
if map(cubes#(1,1)-1,cubes#(1,3)+1)*side(2)>0 and map(cubes#(1,1)-1,cubes#(1,3)+1)<4 then value=0:goto moveend4
99315:
if cubes#(1,1)<1.5 or cubes#(1,3)<1.5 then goto 45333
if map(cubes#(1,1)-1,cubes#(1,3)-1)*side(5)>0 and map(cubes#(1,1)-1,cubes#(1,3)-1)*side(5)<4 then value=0:goto moveend4
45333:
if cubes#(1,1)<1.5 then goto 98888
if map(cubes#(1,1)-2,cubes#(1,3))>0 and map(cubes#(1,1)-2,cubes#(1,3))<4 and side(1)>0 then value=0
98888:
if cubes#(1,1)=1 and side(1)>0 then value=0
moveend4:
endif
endfunction value
rem >>>>>>>>> Make a cube and it's outline in a certain position <<<<<<<<<
function makecube(ObjNum, Type, xPos, zPos)
make object cube ObjNum,0.9
make object cube ObjNum+1000,-1
if Type=2 then color object ObjNum,rgb(160,160,192)
if Type=3 then color object ObjNum,rgb(160,0,160)
color object ObjNum+1000,0
cubes#(ObjNum,1)=xPos:cubes#(ObjNum,2)=0.51:cubes#(ObjNum,3)=zPos
endfunction
rem >>>>>>>> Make a portal <<<<<<<<<<<<
function portal(ObjNum, xPos, zPos)
make object sphere ObjNum,-0.85:color object ObjNum,0
make object sphere ObjNum+1,-0.75:color object ObjNum+1,rgb(255,0,128)
make object sphere ObjNum+2,-0.75
make object sphere ObjNum+3,-0.75:color object ObjNum+3,rgb(255,0,128)
make object sphere ObjNum+4,-0.75
make object sphere ObjNum+5,-0.75:color object ObjNum+5,rgb(255,0,128)
for t = 0 to 5
position object ObjNum+t,xPos,0.5,zPos
next t
endfunction
rem >>>>>>>>> Update a cube's position <<<<<<<<<
function poscube(ObjNum)
position object ObjNum,cubes#(ObjNum,1),cubes#(ObjNum,2),cubes#(ObjNum,3)
position object ObjNum+1000,cubes#(ObjNum,1),cubes#(ObjNum,2),cubes#(ObjNum,3)
endfunction
rem >>>>>>>> Update every cube's position <<<<<<<<
function posallcubes()
for t = 1 to 25
if object exist(t)=1
position object t,cubes#(t,1),cubes#(t,2),cubes#(t,3)
position object t+1000,cubes#(t,1),cubes#(t,2),cubes#(t,3)
endif
next t
endfunction
rem >>>>>>>>> Update the camera <<<<<<<<<<<<
function camera()
position camera cubes#(1,1)+1,4,cubes#(1,3)-4
point camera cubes#(1,1),0,cubes#(1,3)
endfunction
rem >>>>>>>> Undo any rotation on a cube <<<<<<<<<<<<<<
function reset(ObjNum)
rotate object ObjNum,0,0,0
rotate object ObjNum+1000,0,0,0
endfunction
rem >>>>>>>> Stick all the cubes around the player to it <<<<<<<<<<<<
function stick()
round()
for t = 2 to 5
if object exist(t)=0 then goto skip3
for x = 1 to 6
if side(x)=t then goto skip3
next x
if cubes#(t,1)>cubes#(1,1)+1.5 or cubes#(t,1)<cubes#(1,1)-1.5 or cubes#(t,3)>cubes#(1,3)+1.5 or cubes#(t,3)<cubes#(1,3)-1.5 then goto skip3
if cubes#(t,1)<>cubes#(1,1) and cubes#(t,3)<>cubes#(1,3) then goto skip3
stickorig(t)
if cubes#(t,1)=cubes#(1,1)-1 then position(t,-1,0,0):side(4)=t:goto skip3
if cubes#(t,3)=cubes#(1,3)+1 then position(t,0,0,1):side(2)=t:goto skip3
if cubes#(t,3)=cubes#(1,3)-1 then position(t,0,0,-1):side(5)=t:goto skip3
if cubes#(t,1)=cubes#(1,1)+1 then position(t,1,0,0):side(3)=t:goto skip3
skip3:
next t
endfunction
rem >>>>>>> Unstick a cube from the player <<<<<<<<<<<
function unstick(ObjNum)
unglue object ObjNum
unglue object ObjNum+1000
endfunction
rem >>>>>>> Stick a cube to the player <<<<<<<<<<<
function stickorig(ObjNum)
glue object to limb ObjNum,1,0
glue object to limb ObjNum+1000,1,0
endfunction
rem >>>>>>>> Change the position of a cube <<<<<<<<<<<<
function position(ObjNum, xPos, yPos, zPos)
cubes#(ObjNum,1)=xPos
cubes#(ObjNum,2)=yPos
cubes#(ObjNum,3)=zPos
endfunction
rem >>>>>>>>> Animate the portals <<<<<<<<<
function portals()
for x=50 to 100 step 10
if object exist(x)=0 then goto endportals
for p = 1 to 5
for t = 1 to 4
if portalsize#(t)<0 and t=1 then portalsize#(t)=100
if portalsize#(t)<0 and t=2 then portalsize#(t)=100
if portalsize#(t)<0 and t=3 then portalsize#(t)=100
if portalsize#(t)<0 and t=4 then portalsize#(t)=100
portalsize#(t)=portalsize#(t)-0.5
scale object x+t,portalsize#(t),portalsize#(t),portalsize#(t)
if portalsize#(t)>95 and t=1 then color object x+5,rgb(255,255,255)
if portalsize#(t)>95 and t=2 then color object x+5,rgb(255,0,128)
if portalsize#(t)>95 and t=3 then color object x+5,rgb(255,255,255)
if portalsize#(t)>95 and t=4 then color object x+5,rgb(255,0,128)
next t:next p
endportals:
next x
endfunction
rem >>>>>>>>> Draw a map <<<<<<<<<<<
function drawmap()
for t = 0 to 4
for p = 0 to 4
if map(t,p)=0 then ink 0,0
if map(t,p)=1 then ink rgb(0,255,0),0
if map(t,p)=2 then ink rgb(255,0,255),0
if map(t,p)=3 then ink rgb(255,255,255),0
if map(t,p)=4 then ink rgb(0,0,255),0
boxx=t*10:boxy=p*10
box (boxx-2)+5,(boxy-2)+5,(boxx+2)+5,(boxy+2)+5
next p
next t
endfunction
rem >>>>>>>>> Round Cubes# to the nearest number <<<<<<<<<<
function round()
for t = 1 to 10
for p = -1 to 4
if cubes#(t,1)>p+0.5 and cubes#(t,1)<p+1.5 then cubes#(t,1)=p+1
if cubes#(t,3)>p+0.5 and cubes#(t,3)<p+1.5 then cubes#(t,3)=p+1
next p
next t
endfunction
rem >>>>>>>>> Unstick any cubes stuck to the player <<<<<<<<<<
function unstickall()
round()
for t = 2 to 6
cube=side(t)
px=cubes#(1,1):pz=cubes#(1,3)
if side(t)>0
unstick(cube)
reset(cube)
if side(2)>0 then position(cube,px,0,pz+1):moveableheight(cube)
if side(3)>0 then position(cube,px+1,0,pz):moveableheight(cube)
if side(4)>0 then position(cube,px-1,0,pz):moveableheight(cube)
if side(5)>0 then position(cube,px,0,pz-1):moveableheight(cube)
side(t)=0
endif
next t
endfunction
rem >>>>>>>>> Set moveables to the right height <<<<<<<<<<
function moveableheight(ObjNum)
cubes#(ObjNum,2)=0.51:poscube(ObjNum)
endfunction
rem >>>>>>>>> Display the title <<<<<<<<<<<
function title()
load image "logo\c.bmp",1:titlebounce(1,2)=(rnd(10)*(-1))-30
load image "logo\u.bmp",2:titlebounce(2,2)=(rnd(10)*(-1))-30
load image "logo\b.bmp",3:titlebounce(3,2)=(rnd(10)*(-1))-30
load image "logo\e.bmp",4:titlebounce(4,2)=(rnd(10)*(-1))-30
load image "logo\s.bmp",5:titlebounce(5,2)=(rnd(10)*(-1))-30
ink=100:sync on:do
cls
ink rgb(ink,0,ink),rgb(100,0,100)
sprite 2,150+170,titlebounce(2,1)+125,2
sprite 5,150+530,titlebounce(5,1)+115,5
sprite 4,150+420,titlebounce(4,1)+125,4
sprite 1,150,titlebounce(1,1)+75,1
sprite 3,150+270,titlebounce(3,1)+105,3
for t= 1 to 5
if titlebounce(t,2)<8 then titlebounce(t,2)=titlebounce(t,2)+1
titlebounce(t,1)=((titlebounce(t,2)^3)-titlebounce(t,2)*100)/10
next t
set text font ""
set text size 18
if titlebounce(5,2)>6 then center text 800,300,"By Chris Knott"
set text size 72
if titlebounce(5,2)>6 then center text 512,500,"Press Space Bar"
if titlebounce(5,2)>6 and ink>0 then ink=ink-5
if spacekey()=1 then goto leavetitle
sync:loop
leavetitle:
for t= 1 to 5:delete sprite t:delete image t:next t
endfunction
rem >>>>>>>>>>>> Check if a cube is in a portal <<<<<<<<<<<<<
function suckcheck()
value=0
if side(2)=0 then goto 99707
if side(2)>0 and map(cubes#(1,1),cubes#(1,3)+1)=4 then value=2
99707:
if side(3)=0 then goto 77601
if side(3)>0 and map(cubes#(1,1)+1,cubes#(1,3))=4 then value=3
77601:
if side(4)=0 then goto 67131
if side(4)>0 and map(cubes#(1,1)-1,cubes#(1,3))=4 then value=4
67131:
if side(5)=0 then goto endsuck
if side(5)>0 and map(cubes#(1,1),cubes#(1,3)-1)=4 then value=5
endsuck:
endfunction value
rem >>>>>>>>>>> Suck a cube down a portal <<<<<<<<<<<<<<
function suckcube(Side)
round()
if Side=2
cube=side(Side)
x=cubes#(1,1):z=cubes#(1,3)
unstick(cube):side(2)=0
position(cube,x,1,z+1)
moveableheight(cube)
for t = 90 to 0 step -5
scale object cube,t+10,t+10,t+10
scale object cube+1000,t+10,t+10,t+10
zrotate object cube,t:zrotate object cube+1000,t
portals()
sync
next t
delete object cube:delete object cube+1000
endif
if Side=3
cube=side(Side)
x=cubes#(1,1):z=cubes#(1,3)
unstick(cube):side(3)=0
position(cube,x+1,1,z)
moveableheight(cube)
for t = 90 to 0 step -5
scale object cube,t+10,t+10,t+10
scale object cube+1000,t+10,t+10,t+10
zrotate object cube,t:zrotate object cube+1000,t
portals()
sync
next t
delete object cube:delete object cube+1000
endif
if Side=4
cube=side(Side)
x=cubes#(1,1):z=cubes#(1,3)
unstick(cube):side(4)=0
position(cube,x-1,1,z)
moveableheight(cube)
for t = 90 to 0 step -5
scale object cube,t+10,t+10,t+10
scale object cube+1000,t+10,t+10,t+10
zrotate object cube,t:zrotate object cube+1000,t
portals()
sync
next t
delete object cube:delete object cube+1000
endif
if Side=5
cube=side(Side)
x=cubes#(1,1):z=cubes#(1,3)
unstick(cube):side(5)=0
position(cube,x,1,z-1)
moveableheight(cube)
for t = 90 to 0 step -5
scale object cube,t+10,t+10,t+10
scale object cube+1000,t+10,t+10,t+10
zrotate object cube,t:zrotate object cube+1000,t
portals()
sync
next t
delete object cube:delete object cube+1000
endif
endfunction
rem >>>>>>>>>> Check if the player has completed the level <<<<<<<<<
function levelcomplete()
value=1
for t = 2 to 5
if object exist(t)=1 then value=0
next t
endfunction value
rem >>>>>>>>>> Prepare for the next level <<<<<<<<<<<<
function leveldone()
for t = 1 to 26
if object exist(t)=1 then delete object t
if object exist(t+1000)=1 then delete object t+1000
next t
for t = 50 to 100
if object exist(t)=1 then delete object t
if object exist(t+1000)=1 then delete object t+1000
next t
delete object 5000
backdrop off:cls
endfunction
rem >>>>>>>> Make a level <<<<<<<<<<<
function level(LevelNum)
moveables=2:walls=6:portals=50
load image "levels\"+str$(LevelNum)+".bmp",1
paste image 1,0,0
for t = 0 to 4:for p = 0 to 4
if point(t,p)=rgb(255,255,255) then maprev(t,p)=0
if point(t,p)=rgb(0,255,0) then maprev(t,p)=1
if point(t,p)=rgb(128,0,128) then maprev(t,p)=2
if point(t,p)=rgb(255,0,255) then maprev(t,p)=3
if point(t,p)=rgb(0,0,255) then maprev(t,p)=4
next p:next t
for t = 4 to 0 step -1
for p=0 to 4
map(t,p)=maprev(t,4-p)
next p
next t
load image "levels\floor.bmp",1:make object plain 5000,5,5:xrotate object 5000,90:position object 5000,2,0,2:texture object 5000,1
for t = 0 to 4:for p = 0 to 4
if map(t,p)=2 then makecube(moveables,3,t,p):moveables=moveables+1
if map(t,p)=3 then makecube(walls,2,t,p):walls=walls+1
if map(t,p)=1 then makecube(1,1,t,p)
if map(t,p)=4 then portal(portals,t,p):portals=portals+10
next p:next t
delete image 1:sync
endfunction
Make your own media for now, I can't be bothered to upload any.