Guest User

Untitled

a guest
Jan 3rd, 2017
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.74 KB | None | 0 0
  1. --very very little adventure
  2. --by tetsuro -up:00/00/00
  3. --start:10/12/16 - end:30/12/16
  4.  
  5. hero ={
  6.     x = 0,
  7.     y = 0,
  8.     start = 0,
  9.     mirror = false,
  10.     anim = "standnu",
  11.  standnu = {f=28,st=28,sz=2,spd=1/15},
  12.     anim = "walknu",
  13.     walknu = {f=12,st=12,sz=2,spd=1/10},
  14.     anim = "walk",
  15.     walk = {f=1,st=1,sz=2,spd=1/10},
  16.  anim = "stand",
  17.  stand = {f=17,st=17,sz=2,spd=1/15}
  18. }
  19.  
  20. song={}
  21. song.fx={}
  22. song.fx.armor=false
  23. song.fx.door=false
  24.        
  25. old={x=35,y=80} --old man
  26. sold={x=56,y=80} -- soldier
  27. boss={x=80,y=104}
  28. prin={x=100,y=112} --princess royalroom()
  29. pix={x=60,y=60}
  30. lvl = 0
  31. coin={x=0,y=0,up=0}
  32. loop = true --loop of house
  33. looptower = false
  34. looproyal = false
  35. looptext = false --ending message
  36. nude = true
  37. test = false
  38. counthouse = 0 --bubble()
  39. countold = 0 --bubble()
  40. countsold = 0 --bubble()
  41. countsoldier = 0 --bubble()/screen()
  42. countprin = 0 --bubble()/royalroom()
  43. oldanim = 0 --bubble()
  44. arrow = 0 --househero()
  45.  
  46. soldier = false
  47. seller={x=29,y=48} --intower
  48. selleranim = 0 --in tower
  49. countsel = 0 --in tower
  50. bossdead = false --royalroom()
  51.  
  52. cloud={x=128,y=10,spd=1}
  53. cloud2={x=199,y=22,spd=1}
  54. cloud3={x=143,y=35,spd=0.5}
  55. cloud4={x=201,y=42,spd=0.5}
  56. key = false
  57. key2 = false --in tower
  58. chest = false
  59. bluetile = false --getcoin()
  60. bluetile2 = false --getcoin()
  61. bluetile3 = false --getcoin()
  62. bluetile4 = false --intower()
  63. questsoldier = false --bubble()/screen()
  64. ladder = false --ladders()/move()
  65.  
  66. lad = {}
  67.     lad.x = {}
  68.         lad.x.l = 0
  69.         lad.x.r = 0
  70.  lad.y = {}
  71.   lad.y.up = 0
  72.   lad.y.dow = 0
  73. -------------------------------
  74. function bubble()
  75.     --auto exec
  76.     counthouse +=1
  77.     if(lvl==0 and counthouse >60
  78.         and counthouse <180) then
  79.             spr(198,hero.x,hero.y-16,2,2,palt(0,true))--bubble
  80.             spr(201,hero.x+4,hero.y-13,1,1,palt(0,true))--?
  81.     end
  82.     --blocked if nude
  83.     if(lvl==2 and nude== true
  84.         and hero.x==30) then
  85.             hero.x -=1
  86.     end
  87.     --old anim
  88.     if(lvl==2 and hero.x>20 and
  89.         hero.x<30) then
  90.         oldanim +=1
  91.         if(oldanim>30 and oldanim<60) then
  92.             spr(3,old.x,old.y,palt(0,true))
  93.         end
  94.         if(oldanim>60 and oldanim<90) then
  95.             spr(3,old.x,old.y,palt(0,true))
  96.             oldanim = 0
  97.         end
  98.     end
  99.     --old bubble if nude
  100.     if(lvl==2 and nude==true
  101.      and hero.x>20 and hero.x<30) then
  102.         countold +=1
  103.         if(countold<90) then
  104.             spr(198,36,63,2,2,palt(0,true))--bubble
  105.             spr(200,40,65,1,1,palt(0,true))--!
  106.         end
  107.         if(countold>90
  108.             and countold<180) then
  109.             spr(198,36,63,2,2,palt(0,true))--bubble
  110.             spr(216,40,65,1,1,palt(0,true))--!
  111.         end
  112.         if(countold>180
  113.             and countold<270) then
  114.             spr(198,36,63,2,2,palt(0,true))--bubble
  115.             spr(217,40,65,1,1,palt(0,true))--!
  116.         end
  117.  end
  118.  if(countold==360) countold=0
  119.  if(hero.x<20) countold=0
  120.  if(countold==1 and countold<360) sfx(6)
  121.     --old bubble if armor
  122.     if(lvl==2 and nude==false
  123.      and hero.x>20 and hero.x<30) then
  124.         countold +=1
  125.         if(countold<90) then
  126.             spr(198,36,63,2,2,palt(0,true))--bubble
  127.             spr(39,39,64,1,1,palt(0,true))--key
  128.         end
  129.         if(countold>90
  130.             and countold<180) then
  131.             spr(198,36,63,2,2,palt(0,true))--bubble
  132.             spr(202,40,65,1,1,palt(0,true))--mini tower
  133.         end
  134.         if(countold>180
  135.             and countold<270) then
  136.             spr(198,36,63,2,2,palt(0,true))--bubble
  137.             spr(14,39,65,1,1,palt(0,true))--princess
  138.         end
  139.  end
  140.  if(countold==360) countold=0
  141.  if(hero.x<20) countold=0
  142.     --soldier bubble start
  143.     if(questsoldier== false) then
  144.      if(lvl==3 and hero.x>50
  145.          and hero.x<62) then
  146.          countsold +=1
  147.          if(countsold<270) then
  148.             spr(198,61,64,2,2,palt(0,true))--bubble
  149.             spr(218,66,66,1,1)--x3
  150.             spr(203,60,65,1,1)--coin
  151.          end       
  152.   end
  153.   if(countsold==360) countsold=0
  154.   if(hero.x<20) countsold=0
  155.   if(countsold==1 and countsold<360) sfx(6)
  156.     end
  157.     --princess eternal bubble :)
  158.     if(lvl==3 and bossdead==true) then
  159.         countprin +=1
  160.         if(countprin>1) then
  161.                 spr(198,prin.x,prin.y-16,2,2,palt(0,true))--bubble
  162.                 spr(204,prin.x+3,prin.y-14,1,1,palt(0,true))--hearth
  163.         end
  164.  end
  165.    
  166. end
  167. -------------------------------
  168. function scroll()  
  169.     spr(9,cloud.x,cloud.y,2,1,1,palt(0,true))
  170.     spr(9,cloud2.x,cloud2.y,2,1,1,palt(0,true))
  171.     spr(9,cloud3.x,cloud3.y,2,1,palt(0,true))
  172.     spr(9,cloud4.x,cloud4.y,2,1,palt(0,true))
  173.     cloud.x -= cloud.spd
  174.     cloud2.x -= cloud2.spd
  175.     cloud3.x -= cloud3.spd
  176.     cloud4.x -= cloud4.spd
  177.     if(cloud.x==-16) cloud.x = 128
  178.     if(cloud2.x==-16) cloud2.x =140
  179.     if(cloud3.x==-16) cloud3.x = 128
  180.     if(cloud4.x==-16) cloud4.x =140
  181. end
  182. -------------------------------
  183. function testmove()
  184.     --if hero is nude
  185.  if(nude==true) movenude()
  186.  --if hero get armor he's not nude
  187.  if(lvl==0 and hero.x==75
  188.         and loop==true) then
  189.     nude = false
  190.     if(song.fx.armor==false) then
  191.         sfx(5)
  192.         song.fx.armor = true
  193.     end
  194.  end
  195.  --if hero get armor she disappears
  196.  if(nude==false and loop==true) then
  197.   spr(85,72,80,2,1)
  198.  end
  199.  --if hero get armor start move function
  200.  if(nude==false) move()
  201. end
  202. -------------------------------
  203. function movenude()
  204.         if(btn(0)) then --left move
  205.             hero.x -= 1
  206.             hero.mirror = true
  207.             spr(anim(hero.walknu),hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  208.         elseif(btn(1)) then --right move
  209.             hero.x += 1
  210.             hero.mirror = false
  211.             spr(anim(hero.walknu),hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  212.         elseif(btn(2)) then --up
  213.             spr(45,hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  214.         elseif(btn(3)) then --down
  215.         spr(44,hero.x,hero.y,1,1,hero.mirror,palt(0,true)) 
  216.         elseif(btn(4)) then --attack
  217.             spr(31,hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  218.         else --stand
  219.             spr(anim(hero.standnu),hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  220.         end
  221. end
  222. -------------------------------
  223. function move()
  224. if(ladder==false) then
  225.         --left
  226.         if(btn(0)) then
  227.                 hero.x -= 1
  228.                 hero.mirror = true
  229.                 spr(anim(hero.walk),hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  230.         --right
  231.         elseif(btn(1)) then
  232.                 hero.x += 1
  233.                 hero.mirror = false
  234.                 spr(anim(hero.walk),hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  235.         --up
  236.         elseif(btn(2)) then
  237.                 spr(32,hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  238.         --down
  239.         elseif(btn(3)) then
  240.             spr(16,hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  241.         --attack
  242.         elseif(btn(4)) then
  243.                 spr(48,hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  244.         --stand
  245.         else
  246.             spr(anim(hero.stand),hero.x,hero.y,1,1,hero.mirror,palt(0,true))
  247.         end
  248.     end
  249.    
  250. end
  251. -------------------------------
  252. function anim(h) -- h = hero.walk variable copy
  253.     h.f += h.spd
  254.     if (h.f >= h.st + h.sz) then
  255.         h.f = h.st
  256.     end
  257.     return flr(h.f)
  258. end
  259. -------------------------------
  260. function heroxy()
  261.     --colisions
  262.     if(lvl==0 and hero.x==7) hero.x+=1
  263.     if(lvl==4 and hero.x==113) hero.x-=1
  264.     --position de depart
  265.     if(lvl==0 and hero.start==0) then
  266.         hero.x = 21
  267.         hero.y = 80
  268.         hero.start += 1
  269.     end
  270.     --boucle deplacements hero
  271.     if(hero.x > 128) then
  272.         hero.x = 0
  273.         lvl += 1
  274.     end
  275.     if(hero.x < 0) then
  276.         hero.x = 128
  277.         lvl -= 1
  278.     end
  279.     -- 
  280. end
  281. -------------------------------
  282. function screen()
  283.     --house beggin
  284.     if(lvl==0) map(0,0,0,0,16,16)
  285.     --nature
  286.     if(lvl==1) then
  287.         map(16,0,0,0,16,16)
  288.     end
  289.     --village
  290.  if(lvl==2) then
  291.     map(32,0,0,0,16,16)
  292.     spr(4,old.x,old.y,palt(0,true))
  293.  end
  294.  --tower (1)
  295.  if(lvl==3) then
  296.      map(48,0,0,0,16,16)
  297.   spr(19,sold.x,sold.y,2,1,palt(0,true))
  298.         --move soldier
  299.         if(lvl==3 and coin.up==3  
  300.         and hero.x>59 and hero.x<68
  301.         and countsoldier<15) then
  302.             sold.x +=1
  303.             countsoldier +=1
  304.             questsoldier = true
  305.             if(countsoldier==15) then
  306.                 coin.up = 0
  307.             end
  308.         end
  309.     end
  310.     --tower (2)
  311.     --nature flowers
  312.     if(lvl==4) then
  313.         map(80,0,0,0,16,16)
  314.     end
  315.     --nature collisions floor 1
  316.  if(lvl==4
  317.  and hero.x<40 and hero.y==48) then
  318.   hero.x +=1
  319.  end
  320.  if(lvl==4
  321.  and hero.x>112 and hero.y==48) then
  322.      hero.x -=1
  323.     end
  324.     --nature collisions floor 2
  325.  if(lvl==4
  326.  and hero.x<24 and hero.y==8) then
  327.   hero.x +=1
  328.  end
  329.  if(lvl==4
  330.  and hero.x>112 and hero.y==8) then
  331.      hero.x -=1
  332.     end
  333. end
  334. -------------------------------
  335. function tests()
  336.             if(btn(4)) test = true
  337.                 spr(11,pix.x,pix.y)
  338.                 print("test:"..(test and 'true' or 'false'),10,10,8)
  339.                 print("x:"..pix.x,10,16,10)
  340.                 print("y:"..pix.y,10,22,10)
  341.                 print("hero.start:"..hero.start,10,29,11)
  342.                 print("lvl:"..lvl,10,36,7)
  343.                 if(btn(0)) pix.x -= 1
  344.                 if(btn(1)) pix.x += 1
  345.                 if(btn(2)) pix.y -= 1
  346.                 if(btn(3)) pix.y += 1
  347.                 if(btn(5)) test = false
  348.                 if(btnp(5)) lvl +=1
  349.             if(lvl==5) lvl = 0
  350. end
  351. -------------------------------
  352. function househero()
  353.     -- window  
  354.     if(lvl==0) then
  355.         spr(174,60,65,2,2,palt(0,true))
  356.     end
  357.     -- door
  358.     if(lvl==0) then
  359.         spr(106,44,72,2,2,palt(0,true))
  360.     end
  361.     --anim arrow up
  362.  if(lvl==0 and hero.x>=45
  363.     and hero.x<=51) then
  364.     arrow += 1
  365.   if(arrow<15) spr(91,49,77,1,1)--arrow 91
  366.   if(arrow>30) arrow = 0
  367.     end
  368.     --enter in house   
  369.     if(lvl==0 and hero.x>=45
  370.     and hero.x<=51 and btn(2)) then
  371.     loop = true
  372.     sfx(7)
  373.     end
  374.  --display interior house
  375.  if(loop==true) then
  376.     --wall collisions
  377.   if(hero.x<17) hero.x +=1
  378.   if(hero.x>79) hero.x -=1
  379.   -- interior of house
  380.   map(2,16,16,16,9,9)
  381.   spr(37,19,80,2,1,palt(0,true))--bed
  382.         spr(42,60,80,1,1,palt(0,true))--table
  383.         if(nude==true) spr(8,75,80,1,1,palt(0,true))--armor
  384.         spr(43,47,41,1,1,palt(0,true))--lamp
  385.         spr(30,30,70,1,1,palt(0,true))--frame
  386.         spr(93,44,72,2,2,palt(0,true))--transparent door
  387.         --anim arrow down
  388.         if(lvl==0 and hero.x>=45
  389.                 and hero.x<=51) then
  390.                 arrow += 1
  391.         if(arrow<15) spr(92,49,89,1,1)--arrow 91
  392.         if(arrow>30) arrow = 0
  393.         end
  394.         --exit to house
  395.         if(lvl==0 and hero.x>=45
  396.         and hero.x<=51 and btn(3)) then
  397.    loop = false
  398.    sfx(7)
  399.     end
  400.     end
  401.     bubble()
  402. end
  403. -------------------------------
  404. function housevillage()
  405.     --exterior door
  406.     if(lvl==2) then
  407.         spr(106,80,72,2,2,palt(0,true))
  408.     end
  409.     --anim arrow up
  410.  if(lvl==2 and hero.x>=80
  411.     and hero.x<=90) then
  412.     arrow += 1
  413.   if(arrow<15) spr(91,85,77,1,1)--arrow 91
  414.   if(arrow>30) arrow = 0
  415.  end
  416.  --contidion to enter house
  417.  if(lvl==2 and hero.x>=80
  418.     and hero.x<=90 and btn(2)) then
  419.             loopvillage = true
  420.          sfx(7)
  421.     end
  422.     --in house
  423.     if(loopvillage==true) then     
  424.         if(hero.x < 57) hero.x +=1
  425.         if(hero.x > 103) hero.x -=1
  426.         map(39,16,56,24,7,8)
  427.         spr(23,60,80,1,1,1,palt(0,true))--chest
  428.         spr(93,80,72,2,2,palt(0,true))--transparent door
  429.         --open chest and get key
  430.         if(hero.x==64 and key==false) then
  431.             chest = true
  432.             key = true
  433.             sfx(3)
  434.         end
  435.             if(chest==true) spr(24,60,80,1,1,1,palt(0,true))--chest open
  436.         --anim arrow down
  437.         if(lvl==2 and hero.x>=80
  438.                 and hero.x<=90) then
  439.                 arrow += 1
  440.         if(arrow<15) spr(92,85,89,1,1)--arrow 91
  441.         if(arrow>30) arrow = 0
  442.         end
  443.     end
  444.     --exit from house
  445.     if(lvl==2 and hero.x>=80
  446.         and hero.x<=90 and btn(3)) then
  447.     loopvillage = false
  448.             sfx(7)
  449.  end
  450. end
  451. -------------------------------
  452. function intower()
  453.     --to enter in tower
  454.     if(lvl==3 and hero.x>=55
  455.         and hero.x<=72 and hero.y==80
  456.         and btn(2) and key==true
  457.         and questsoldier==true
  458.         and looptower==false) then
  459.    looptower = true
  460.    hero.x = 60
  461.    hero.y = 112
  462.    bluetile4 = true
  463.    sfx(7)
  464.    music(9)
  465.     end
  466.     --anim arrow up
  467.  if(lvl==3 and hero.x>=58
  468.         and hero.x<=69 and coin.up==1) then
  469.         arrow += 1
  470.         if(arrow<15) spr(91,61,74,1,1)--arrow up
  471.         if(arrow>30) arrow = 0
  472.     end
  473.     --display interior tower
  474.     if(looptower==true) then
  475.     --wall collisions
  476.   --floor 1
  477.   if(hero.x<25 and hero.y==112) hero.x +=1
  478.   if(hero.x>94 and hero.y==112) hero.x -=1
  479.   --floor 2
  480.   if(hero.x<25 and hero.y==80) hero.x +=1
  481.   if(hero.x>94 and hero.y==80) hero.x -=1
  482.   --floor 3
  483.   if(hero.x<25 and hero.y==48) hero.x +=1
  484.   if(hero.x>94 and hero.y==48) hero.x -=1  
  485.   --floor 4
  486.   if(hero.x<25 and hero.y==16) hero.x +=1
  487.   if(hero.x>94 and hero.y==16) hero.x -=1  
  488.   --floor 4 bis
  489.   if(hero.x<2 and hero.y==0) hero.x +=1
  490.   if(hero.x>24 and hero.y==0) hero.x -=1  
  491.   --interior tower
  492.   map(64,0,0,0,16,16)
  493.         spr(139,56,104,2,2,palt(0,true))--transparent door
  494.         spr(144,56,8,2,2,palt(0,true))--red door
  495.         spr(180,seller.x,seller.y,1,1,palt(0,true))--seller
  496.         --seller anim
  497.         if(lvl==3 and hero.x>24 and
  498.         hero.x<45 and hero.y==48) then
  499.             spr(180,seller.x,seller.y,palt(0,true))
  500.         end
  501.         if(lvl==3 and hero.x>24 and
  502.             hero.x<45 and hero.y==48) then
  503.                 selleranim +=1
  504.             if(selleranim>30 and selleranim<60) then
  505.                 spr(181,seller.x,seller.y,palt(0,true))
  506.             end
  507.             if(selleranim>60 and selleranim<90) then
  508.                     spr(181,seller.x,seller.y,palt(0,true))
  509.                     selleranim = 0
  510.                 end
  511.             end
  512.             --seller bubble
  513.             if(lvl==3 and hero.y==48
  514.          and hero.x>24 and hero.x<45) then
  515.             countsel +=1
  516.             if(countsel<90) then
  517.                 spr(198,30,32,2,2,palt(0,true))--bubble
  518.                 spr(39,33,33,1,1,palt(0,true))--key
  519.                 if(key2==true) then
  520.                     spr(177,34,34,1,1,palt(0,true))--mini door
  521.                 end
  522.             end
  523.             if(countsel>90
  524.                 and countsel<180) then
  525.                 spr(198,30,32,2,2,palt(0,true))--bubble
  526.                 spr(219,35,34,1,1,palt(0,true))--x1
  527.                 spr(203,29,33,1,1,palt(0,true))--coin
  528.                 if(key2==true) then
  529.                     spr(178,35,34,1,1,palt(0,true))--x1
  530.                     spr(220,29,33,1,1,palt(0,true))--white coin
  531.                     spr(177,34,34,1,1,palt(0,true))--mini door
  532.                 end
  533.             end
  534.      end
  535.      if(countsel==270) countsel=0
  536.      if(hero.x<20) countsel=0
  537.      if(countsel==1 and countsel<270) sfx(6)
  538.         --buy key to seller
  539.         if(lvl==3 and hero.x>24 and
  540.             hero.x<45 and hero.y==48
  541.             and coin.up==1) then
  542.             key2 = true
  543.             coin.up = 0
  544.         end
  545.         --enter in royal room
  546.         if(lvl==3 and btn(2)
  547.         and hero.x>=59 and hero.x<=68
  548.         and hero.y==16 and key2==true) then
  549.             looptower = false
  550.             looproyal = true
  551.             --new position hero in royal room
  552.             hero.x = 60
  553.     hero.y = 112
  554.     sfx(7)
  555.     music(10)
  556.         end
  557.         --anim key up royal door
  558.     if(lvl==3 and hero.x>=58
  559.             and hero.x<=69 and hero.y==16
  560.             and key2==false) then
  561.             arrow += 1
  562.             if(arrow<15) spr(162,60,4,1,1,palt(0,true))--key2 up
  563.             if(arrow>30) arrow = 0
  564.         end
  565.         --anim arrow down
  566.         if(lvl==3 and hero.x>=58
  567.                 and hero.x<=69
  568.                 and hero.y==112) then
  569.                 arrow += 1
  570.         if(arrow<15) spr(92,61,121,1,1)--arrow 91
  571.         if(arrow>30) arrow = 0
  572.         end
  573.         --to exit tower
  574.         if(lvl==3 and hero.x>=55
  575.             and hero.x<=72 and hero.y==112
  576.             and btn(3)) then
  577.     looptower = false
  578.     hero.x = 60
  579.     hero.y = 80
  580.     sfx(7)
  581.     end
  582.     end
  583. end
  584. -------------------------------
  585. function royalroom()
  586.     if(looproyal==true) then
  587.         map(96,0,0,0,16,16,palt(0,true))
  588.         spr(14,prin.x,prin.y,1,1,palt(0,true))--princess
  589. --      spr(93,56,104,2,2,palt(0,true))--transparent door
  590.         --music(10)
  591.         --walls collisions
  592.         if(hero.y==112 and hero.x<2) then
  593.             hero.x +=1
  594.         end
  595.         if(hero.y==112 and hero.x>118) then
  596.             hero.x -=1
  597.         end
  598.         --to exit royal room
  599. --      if(lvl==3 and btn(3)
  600. --      and hero.x>=59 and hero.x<=68
  601. --      and hero.y==112) then
  602. --      looproyal = false
  603. --      looptower = true
  604. --      hero.x = 60
  605. --      hero.y = 16
  606. --  end
  607.     --anim arrow down
  608. --  if(lvl==3 and hero.x>=59
  609. --          and hero.x<=68
  610. --          and hero.y==112) then
  611. --          arrow += 1
  612. --      if(arrow<15) spr(92,61,121,1,1)--arrow 91
  613. --      if(arrow>30) arrow = 0
  614. --  end
  615.  
  616.  --boss fight
  617.  spr(141,boss.x,boss.y,2,2,palt(0,true))
  618.  
  619.  if(hero.x>=79 and hero.y==112
  620.  and btn(4) and bossdead==false) then  
  621.         bossdead = true
  622.         sfx(10)
  623.      music(8)
  624.     end
  625.     --the end
  626.     if(bossdead==true) then
  627.         boss.y -= 5
  628.         hero.x = 80
  629.         prin.x -= 1
  630.         --
  631.         function heroend()
  632.             spr(153,72,112,1,1)--wall
  633.             spr(153,80,112,1,1)--wall
  634.             spr(1,80,112,1,1)--hero
  635.         end
  636.         --princess reposition
  637.         if(prin.x==86) then
  638.             prin.x = 86
  639.             prin.x +=1
  640.         end
  641.         --display end text message
  642.         if(boss.y==-16) looptext = true
  643.         if(looptext==true) then
  644.             map(1,49,8,37,14,5,palt(0,false))
  645.             print("thank you for playing !",19,44,15)
  646.             print("the end...",47,55,10)
  647.             print("code/graphic/sound-tetsuro",12,66,6)
  648.         end
  649.     end
  650.     if(bossdead==false
  651.     and hero.x==80) then
  652.         hero.x -= 1
  653.     end
  654.     --
  655.  
  656.     --
  657.     end
  658. end
  659. -------------------------------
  660. function getcoin()
  661.     --paste coins
  662.     if(lvl==4) then
  663.         spr(7,112,80,palt(0,true))
  664.         spr(7,34,8,palt(0,true))
  665.         spr(7,96,48,palt(0,true))
  666.     end
  667.     --get coin 1
  668.     if(lvl==4 and bluetile==false
  669.     and hero.x==112 and hero.y==80) then
  670.         coin.up +=1
  671.         bluetile = true
  672.         sfx(4)
  673.     end
  674.         --get coin 2
  675.     if(lvl==4 and bluetile2==false
  676.     and hero.x==34 and hero.y==8) then
  677.         coin.up +=1
  678.         bluetile2 = true
  679.         sfx(4)
  680.     end
  681.         --get coin 3
  682.     if(lvl==4 and bluetile3==false
  683.     and hero.x==96 and hero.y==48) then
  684.         coin.up +=1
  685.         bluetile3 = true
  686.         sfx(4)
  687.     end
  688.     --get secret coin in tower
  689.     if(lvl==3 and coin.up==0
  690.     and hero.x==3 and hero.y==0) then
  691.         coin.up = 1
  692.         sfx(4)
  693.     end
  694.     --paste blue tile 1
  695.     if(lvl==4 and bluetile==true) then
  696.         spr(51,112,80)         
  697.     end
  698.     --paste blue tile 2
  699.     if(lvl==4 and bluetile2==true) then
  700.         spr(51,34,8)           
  701.     end
  702.     --paste blue tile 3
  703.     if(lvl==4 and bluetile3==true) then
  704.         spr(51,96,48)          
  705.     end
  706. end
  707. -------------------------------
  708. function hud()
  709.     spr(7,2,0,palt(0,true))--coin
  710.     print(coin.up,11,3,10)--counter coins
  711.     if(key==true) spr(39,2,7,1,1,palt(0,true))--key
  712.     --paste blue tile 4 for key2
  713.     if(bluetile4==true) then
  714.         spr(51,3,9)        
  715.     end
  716.     --key 2
  717.     if(key2==true) spr(39,2,9,1,1,palt(0,true))--key2
  718. end
  719. -------------------------------
  720. function ladders()
  721.     --house ladder lvl 0 (for tests)
  722. --  if(lvl==0) then
  723. --  lad.x.l = 95
  724. --  lad.x.r = 97
  725. --  lad.y.up = 48
  726. --      lad.y.dow = 80
  727. -- end
  728.  --nature no ladder
  729.     if(lvl==1) then
  730.   lad.x.l = 0
  731.   lad.x.r = 0
  732.     lad.y.up = 0
  733.         lad.y.dow = 0
  734.  end
  735.  --city no ladder
  736.     if(lvl==2) then
  737.   lad.x.l = 0
  738.   lad.x.r = 0
  739.     lad.y.up = 0
  740.         lad.y.dow = 0
  741.  end
  742.  --front tower no ladder
  743.     if(lvl==3) then
  744.   lad.x.l = 0
  745.   lad.x.r = 0
  746.     lad.y.up = 0
  747.         lad.y.dow = 0
  748.  end
  749.     --nature flowers ladder 1
  750.  if(lvl==4) then
  751.   lad.x.l = 55
  752.   lad.x.r = 57
  753.     lad.y.up = 48
  754.         lad.y.dow = 80
  755.  end
  756.  --nature flowers ladder 2
  757.  if(lvl==4
  758.  and hero.y<=48
  759.  and hero.x>=70) then
  760.   lad.x.l = 71
  761.   lad.x.r = 73
  762.     lad.y.up = 8
  763.         lad.y.dow = 48
  764.  end
  765.  --in tower ladder 1
  766.  if(lvl==3 and looptower==true
  767.  and hero.y<=112
  768.  and hero.x<=52) then
  769.     lad.x.l = 31
  770.   lad.x.r = 33
  771.     lad.y.up = 80
  772.         lad.y.dow = 112
  773.  end
  774.  --in tower ladder 2
  775.  if(lvl==3 and looptower==true
  776.  and hero.y<=80
  777.  and hero.x>=52) then
  778.     lad.x.l = 71
  779.   lad.x.r = 73
  780.     lad.y.up = 48
  781.         lad.y.dow = 80
  782.  end
  783.  --in tower ladder 3
  784.  if(lvl==3 and looptower==true
  785.  and hero.y<=48
  786.  and hero.x>=84) then
  787.     lad.x.l = 87
  788.   lad.x.r = 90
  789.     lad.y.up = 16
  790.         lad.y.dow = 48
  791.  end
  792.  --in tower ladder 4
  793.  if(lvl==3 and looptower==true
  794.  and hero.y<=16
  795.  and hero.x<=50) then
  796.     lad.x.l = 23
  797.   lad.x.r = 26
  798.     lad.y.up = 0
  799.         lad.y.dow = 16
  800.  end
  801.  --acces to down ladder
  802.  if(btn(2)
  803.  and hero.x>=lad.x.l
  804.  and hero.x<=lad.x.r
  805.  and hero.y<=lad.y.dow) then
  806.   hero.y -=1
  807.   ladder = true
  808.  end
  809.  --acces to up ladder
  810.  if(btn(3)
  811.  and hero.x>=lad.x.l
  812.  and hero.x<=lad.x.r
  813.  and hero.y>=lad.y.up) then
  814.   hero.y +=1
  815.   ladder = true
  816.  end
  817.  --blocked if up to ladder
  818.     if(btn(2)
  819.     and hero.y==lad.y.up-1) then
  820.     hero.y +=1
  821.  end
  822.  --blocked if down to ladder
  823.  if(btn(3)
  824.  and hero.y==lad.y.dow+1) then
  825.     hero.y -=1
  826.  end
  827.     --constrain if left
  828.     if(btn(0)
  829.  and hero.x>=lad.x.l
  830.  and hero.x<=lad.x.r
  831.     and hero.y<=lad.y.dow-1
  832.     and hero.y>=lad.y.up+1) then
  833.      hero.x +=1
  834.     end
  835.     --constrain if right
  836.     if(btn(1)
  837.  and hero.x>=lad.x.l
  838.  and hero.x<=lad.x.r
  839.     and hero.y<=lad.y.dow-1
  840.     and hero.y>=lad.y.up+1) then
  841.      hero.x -=1
  842.     end
  843.     --bug if left and right together
  844.     if(btn(0) and btn(1)
  845.  and hero.x>=lad.x.l
  846.  and hero.x<=lad.x.r
  847.     and hero.y<=lad.y.dow-1
  848.     and hero.y>=lad.y.up+1) then
  849.      hero.x +=1
  850.     end
  851.    
  852.     ladder = false
  853. end
  854. -------------------------------
  855. function _init()
  856.  music(11) 
  857. -- if(looptower==true) music(09)
  858. --  if(looproyal==true) music(10)
  859. --  if(bossdead==true) music(8)
  860. end
  861.  
  862. function _update()
  863. end
  864.  
  865. function _draw()
  866.     cls()
  867.     screen()
  868.     getcoin()
  869.     heroxy()
  870.     ladders()
  871.     househero()
  872.     housevillage()
  873.  hud()
  874.  scroll()
  875.  intower()
  876.  royalroom()
  877.  testmove()
  878.  bubble()
  879.     if(bossdead==true) heroend()
  880.  --tests()
  881. end
Advertisement
Add Comment
Please, Sign In to add comment