Advertisement
Jousway

OJ_Gameplay

Dec 15th, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.10 KB | None | 0 0
  1.             function OJ_gameplay(pn)
  2.                 SOUND:PlayOnce(songName..'lua/p'..pn..'.ogg')
  3.                 if effect[pn] == 2 then
  4.                     roll1[pn] = math.random(1,6)
  5.                     roll3[pn] = math.random(1,6)
  6.                     roll = roll1[pn]+roll3[pn]
  7.                     rspace[pn] = '+'
  8.                     effect[pn] = 0
  9.                 else
  10.                     roll1[pn] = math.random(1,6)
  11.                     roll3[pn] = ''
  12.                     roll = roll1[pn]
  13.                     rspace[pn] = ''
  14.                 end
  15.                 if pn == 1 then
  16.                     pn2 = 2
  17.                     stars[1] = stars[1] + 5
  18.                     stars[2] = stars[2] + 5
  19.                     battlestars[1] = stars[1]
  20.                     battlestars[2] = stars[2]
  21.                     stars1:settext(stars[1])
  22.                     stars2:settext(stars[2])
  23.                 else
  24.                     pn2 = 1
  25.                     stars1:settext(stars[1])
  26.                     stars2:settext(stars[2])
  27.                 end
  28.                 dice[1]:settext(roll..'\n\n'..roll1[pn]..rspace[pn]..roll3[pn])
  29.                 sdice('sleep',bl*4)
  30.                 sdice('queuecommand','empty')
  31.                 spn('sleep',bl*4)
  32.                 croll = 0
  33.                 local sroll = roll
  34.                 local fite = false
  35.                 local wait = {}
  36.                 repeat
  37.                     lastpos[pn] = lastpos[pn] + 1
  38.                     croll = croll + 1
  39.                     if lastpos[pn] == 9 then lastpos[pn] = 1 end
  40.                     Player[pn]:linear(bl)
  41.                     Player[pn]:x(platpos[lastpos[pn]][1])
  42.                     Player[pn]:y(platpos[lastpos[pn]][2])
  43.                     roll = roll - 1
  44.                     panel = true
  45.                     if lastpos[pn] == lastpos[pn2] then
  46.                         soundfile2 = songName..'lua/battle.ogg'
  47.                         sdice('sleep',bl*(croll+2))
  48.                         dice[1]:queuecommand('playsound2')
  49.                         Player[pn2]:sleep(bl*croll)
  50.                         spn('sleep',bl*2)
  51.                         spn('linear',0.000001)
  52.                         spn('x',{SCREEN_CENTER_X-180,SCREEN_CENTER_X+180})
  53.                         spn('y',SCREEN_CENTER_Y)
  54.                         spn('zoom',.75)
  55.                         sdice('x',{SCREEN_CENTER_X-32,SCREEN_CENTER_X+32})
  56.                         if charmode[pn] or charmode[pn2] then
  57.                             charidle:sleep(bl*(croll+6))
  58.                             charattack:sleep(bl*(croll+6))
  59.                             charhurt:sleep(bl*(croll+6))
  60.                         end
  61.                        
  62.                         if pn == 1 then
  63.                             KO = false
  64.                             OJ_battle(pn,pn2,45,3,7,100)
  65.                             if KO then
  66.                                 wait[1] = 4+croll
  67.                                 wait[2] = 2+10
  68.                                 wait[3] = 2
  69.                             else
  70.                                 OJ_battle(pn2,pn,-45,7,3,200)
  71.                                 wait[1] = 4+croll
  72.                                 wait[2] = 2+10+10
  73.                                 wait[3] = 2
  74.                                 if KO then
  75.                                     panel = false
  76.                                 end
  77.                             end
  78.                         else
  79.                             KO = false
  80.                             OJ_battle(pn,pn2,-45,7,3,100)
  81.                             if KO then
  82.                                 wait[1] = 4+croll
  83.                                 wait[2] = 2+10
  84.                                 wait[3] = 2
  85.                             else
  86.                                 OJ_battle(pn2,pn,45,3,7,200)
  87.                                 wait[1] = 4+croll
  88.                                 wait[2] = 2+10+10
  89.                                 wait[3] = 2
  90.                                 if KO then
  91.                                     panel = false
  92.                                 end
  93.                             end
  94.                         end
  95.                         sdice('x',SCREEN_CENTER_X)
  96.                         spn('sleep',bl*6)
  97.                         spn('x',{platpos[lastpos[1]][1],platpos[lastpos[2]][1]})
  98.                         spn('y',{platpos[lastpos[1]][2],platpos[lastpos[2]][2]})
  99.                         spn('zoom',.5)
  100.                         stars1:sleep(bl*((wait[1]*2)+wait[2]-5))
  101.                         stars2:sleep(bl*((wait[1]*2)+wait[2]-5))
  102.                         stars1:queuecommand('bstars')
  103.                         stars2:queuecommand('bstars')
  104.                         stars1:sleep(bl*5)
  105.                         stars2:sleep(bl*5)
  106.                         roll = 0
  107.                         fite = true
  108.                     else
  109.                         wait[1] = 4+croll
  110.                         wait[2] = -croll
  111.                         wait[3] = croll
  112.                     end
  113.                 until roll == 0
  114.                 if panel == true then
  115.                     soundfile = songName..'lua/'..platfuc[lastpos[pn]]..'.ogg'
  116.                     dice[1]:sleep(bl*wait[1])
  117.                     dice[1]:queuecommand('playsound')
  118.                     roll4 = math.random(1,6)
  119.                     if platfuc[lastpos[pn]] == 'bonus' then
  120.                         stars[pn] = stars[pn] + roll4
  121.                         dice[1]:sleep(bl*5)
  122.                         dice[1]:queuecommand('texts')
  123.                     elseif platfuc[lastpos[pn]] == 'drop' then
  124.                         stars[pn] = stars[pn] - roll4
  125.                         dice[1]:sleep(bl*5)
  126.                         dice[1]:queuecommand('texts')
  127.                     elseif platfuc[lastpos[pn]] == 'warp' then
  128.                         if lastpos[pn] == 4 then
  129.                             lastpos[pn] = 8
  130.                         else
  131.                             lastpos[pn] = 4
  132.                         end
  133.                         dice[1]:sleep(bl*5)
  134.                         Player[pn]:sleep(bl*(wait[3]+1))
  135.                         Player[pn]:linear(bl)
  136.                         Player[pn]:rotationy(180*4)
  137.                         Player[pn]:linear(.000001)
  138.                         Player[pn]:rotationy(0)
  139.                         Player[pn]:x(platpos[lastpos[pn]][1])
  140.                         Player[pn]:y(platpos[lastpos[pn]][2])
  141.                     elseif platfuc[lastpos[pn]] == 'draw' then
  142.                         local drawcard = math.random(1,2)
  143.                         dice[1]:sleep(bl*5)
  144.                         card[drawcard]:sleep(bl*((wait[1]*2)+wait[2]))
  145.                         card[drawcard]:linear(.000001)
  146.                         card[drawcard]:diffusealpha(1)
  147.                         card[drawcard]:linear(bl/2)
  148.                         card[drawcard]:y(SCREEN_CENTER_Y-100)
  149.                         card[drawcard]:rotationy(180*2)
  150.                         card[drawcard]:linear(bl/2)
  151.                         card[drawcard]:y(SCREEN_CENTER_Y)
  152.                         card[drawcard]:rotationy(0)
  153.                         card[drawcard]:linear(bl/2)
  154.                         card[drawcard]:zoom(.5)
  155.                         card[drawcard]:linear(.000001)
  156.                         card[drawcard]:sleep(bl)
  157.                         card[drawcard]:diffusealpha(0)
  158.                         card[drawcard]:zoom(.25)
  159.                         effect[pn] = drawcard
  160.                     end
  161.                 else
  162.                     dice[1]:sleep(bl*(wait[1]+5))
  163.                 end
  164.                 if stars[pn] < 0 then stars[pn] = 0 end
  165.                 if fite == true then
  166.                     stars1:sleep(bl*(5))
  167.                     stars2:sleep(bl*(5))
  168.                 else
  169.                     stars1:sleep(bl*((wait[1]*2)+wait[2]+5))
  170.                     stars2:sleep(bl*((wait[1]*2)+wait[2]+5))
  171.                 end
  172.                 stars1:queuecommand('stars')
  173.                 stars2:queuecommand('stars')               
  174.                 dice[1]:sleep(bl*4)
  175.                 dice[1]:queuecommand('GameLoop')
  176.             end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement