0  ÆÆÆ±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3<W
0      ÿÿÿÿ    ÿÿÿÿ2Tv˜ºÜþïÍ«‰gE#2Tv˜ºÜþ2Tv˜ºÜþ """"""""""""""""""""""""""""""""""  "" """" " """ "" """""""" "" """"" "  " " "  "  " """!"" """""" "" ""!"""""""""""""""""""""!"!""""                            !!!!""""""""""""""""""""""""""""                                                                                                                                                                                                                                "   " " "" ""   "" "" " "" """"" """"         "  """"" "" "  " " ""!"""""""""!""!"""!"!""!"""""""!""""""""""""""""""""   " """"                         """"""""""""""""""""""""""""                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         "  "                          "  "                          "  "                             "                                                                                                                                                                                                                                                                                                                                                                                                  "  "" " " " " ""                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         		                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	>                                                                                  À?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ¬ -- title:   BEAMY AND MEABY
-- author:  DeltriDev
-- desc:    Puzzle platformer with 2 colours
-- site:    website link
-- license: MIT License (change this to your license of choice)
-- version: 0.2
-- script:  lua

t=0
x=120-32
y=100
vx=0
vy=0
x2=120+10
y2=100
vx2=0
vy2=0
maxRopeSize=50
player=1
screencolor=1
jump=false
jump2=false
t=0
t2=0
keys=0
onground=false
onground2=false
mapx=0
mapy=0
levelcolors={1,0,1,0,1}
e=1
poke(0x7FC3F,1,1)

function TIC()
 if key(18) then reset() end
 vx=0
 vy=0
 vx2=0
 vy2=0
	if player==1 then
  if btnp(0) and onground  then jump=true if RopeCheck() then jump=false vy=vy+1 end end
 	if btn(2) then vx=vx-1 if RopeCheck()then x=x+1 end end
		if btn(3) then vx=vx+1 if RopeCheck()then x=x-1 end end
 end
 if player==2 then
  if btnp(0) and onground2 then jump2=true if RopeCheck() then jump2=false vy2=vy2+1 end end
 	if btn(2) then vx2=vx2-1 if RopeCheck()then vx2=vx2+1 end end
		if btn(3) then vx2=vx2+1 if RopeCheck()then vx2=vx2-1 end end
 end
 if btnp(4) then player=player+1 end
 if player==3 then player=1 end
 if jump then t=t+1 if t<20 then vy=math.floor(vy-2/(t/2)) end if t>23 then jump=false t=0 end end
 if jump2 then t2=t2+1 if t2<20 then vy2=math.floor(vy2-2/(t2/2)) end if t2>23 then jump2=false t2=0 end end
 Gravity()
 Physics()
 RopePhysics()
 x=x+vx
 y=y+vy
 x2=x2+vx2
 y2=y2+vy2 
 if x>240 then e=e+1 x=0 x2=0 mapx=mapx+30 y2=y end
 if x2>240 then e=e+1 x=0 x2=0 mapx=mapx+30 y=y2 end
 if x<0 then e=e-1 x=224 x2=224 mapx=mapx-30 y2=y end
 if x2<0 then e=e-1 x=224 x2=224 mapx=mapx-30 y=y2 end
	cls(levelcolors[e])
	if player==2 then
  circ(x+6, y+8, 20, 1)
  circ(x2+6, y2+8, 20, 0)
 else
  circ(x2+6, y2+8, 20, 0)
  circ(x+6, y+8, 20, 1)
 end
 map(mapx,mapy,30,17,0,0,2)
	line(x+11,y+10,x2-1,y2+10,1)
	line(x+12,y+11,x2-2,y2+11,0)
	if player==2 then
	 spr(1,x,y,2,1,0,0,2,2)
  spr(3,x2,y2,2,1,0,0,2,2)	
 else
  spr(3,x2,y2,2,1,0,0,2,2)
  spr(1,x,y,2,1,0,0,2,2)
 end
 if e==1 then spr(32,85,27,2,2,0,0,4,4) print("BEAMY", 89, 37, 1, false, 2) print("MEABY", 89, 70, 0, false, 2) print("USE THE ARROW KEYS TO MOVE", 44, 10, 0) print("USE Z TO CHANGE TWIN", 60, 20, 0)print("By DeltriDev", 84, 94, 0) end
 if e==2 then print("BEAMY AND MEABY ARE TWINS", 44, 10, 1)  print("BEAMY EMITS LIGHT AND MEABY EMITS DARKNESS", 5, 20, 1) end  
 if e==3 then print("THEY ARE CONNECTED FROM BIRTH\n        WITH A MAGIC ROPE", 40, 10, 0)  print("FIND THE SECRET KEY TO OPEN THE DOOR", 20, 25, 0) end
 if e==4 then print("BEAMY CAN'T SEE THE WHITE \n    HALF BROKEN BRIDGE", 50, 10, 1)  print(" EVEN MEABY HAS TO BE CAREFUL", 40, 25, 1) end
end

function RopeCheck()
 a=math.abs((x+vx)-(x2+vx2))
 b=math.abs((y+vy)-(y2+vy2))
 if a==0 then a=1 end
 if b==0 then b=1 end
 ropeSize=math.sqrt((a*a)+(b*b))
 if ropeSize>maxRopeSize then return true
 else return false end
end 

function Physics()
 if RopeCheck() then vy=0 vy2=0 end
 if solid((x+vx)//8,(y+vy+15)//8) or solid((x+vx+13)//8,(y+vy+15)//8) or solid((x+vx)//8,(y+vy)//8) or solid((x+vx+13)//8,(y+vy)//8) then
  vy=0
  onground=true
 else
  onground=false
 end
 if solid((x+vx)//8,(y+vy+7)//8) or solid((x+vx+13)//8,(y+vy+7)//8)or solid((x+vx)//8,(y+vy+14)//8) or solid((x+vx+13)//8,(y+vy+14)//8) or solid((x+vx)//8,(y+vy)//8) or solid((x+vx+13)//8,(y+vy)//8) then
  vx=0
 end
 if solid((x2+vx2)//8,(y2+vy2+15)//8) or solid((x2+vx2+13)//8,(y2+vy2+15)//8) or solid((x2+vx2)//8,(y2+vy2)//8) or solid((x2+vx2+13)//8,(y2+vy2)//8) then
  vy2=0
  onground2=true
 else
  onground2=false
 end
 if solid((x2+vx2)//8,(y2+vy2+7)//8) or solid((x2+vx2+13)//8,(y2+vy2+7)//8)or solid((x2+vx2)//8,(y2+vy2+14)//8) or solid((x2+vx2+13)//8,(y2+vy2+14)//8) or solid((x2+vx2)//8,(y2+vy2)//8) or solid((x2+vx2+13)//8,(y2+vy2)//8) then
  vx2=0
 end
end

function solid(sx,sy)
 sx=sx+mapx
 sy=sy+mapy
 if fget(mget(sx,sy),2) then keys=keys+2 mset(sx,sy,0) end
 if fget(mget(sx,sy),1) and keys>0 then keys=keys-1 mset(sx,sy,0) end 
 if fget(mget(sx,sy),3) and player==2 then return true
 else return fget(mget(sx,sy),0) end
end

function RopePhysics()
 if onground==false and RopeCheck() and y>y2 then
  if x>x2 then vx=vx-1 vy=vy-1 end 
  if x<x2 then vx=vx+1 vy=vy-1 end 
  Physics()
  if x==x2 then 
   vx=vx2
   vy=vy2
   vy=vy-1
  end
 end
 if onground2==false and RopeCheck() and y2>y then
  if x2>x then vx2=vx2-1 vy2=vy2-1 end 
  if x2<x then vx2=vx2+1 vy2=vy2-1 end 
  Physics()
  if x==x2 then 
   vx2=vx
   vy2=vy
   vy2=vy2-1
  end
 end
end

function Gravity()
  if jump==false then  vy=vy+1 end
 if jump2==false then vy2=vy2+1 end
end