コメント

このコメントは、【トピック】自由な処。へのコメントです。

コメントの内容

User icon mini taki(投稿日:2014/11/16 00:11/16/14)
ここ独り占め
今回使ったメインのスクリプト
loop = true
setBaseTime()

setCanvasVisible(true)

line0 = createSprite(247580)
setSpriteRect(line0, 0, 0, 512, 4, 0, 0, 512, 4)
setSpritePosition(line0,0 ,224)

line1 = createSprite(247580)
setSpriteRect(line1, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line1, 2)

line2 = createSprite(247580)
setSpriteRect(line2, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line2, 2)

line3 = createSprite(247580)
setSpriteRect(line3, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line3, 2)

line4 = createSprite(247580)
setSpriteRect(line4, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line4, 2)

id2 = createSprite(255327)
setSpriteRect(id2, 0, 0, 512, 384, 0, 0, 512, 384)
setSpritePosition(id2, 0, 0)
drawCanvas()
speak("Please Push Z key to Start")
case rand(3)
   when 0
     playBGM(189465)
   when 1
     playBGM(257118)
   when 2
      playBGM(262837)
end

id3 = createSprite(263468)
setSpriteRect(id3, 0, 0, 512, 100, 0, 0, 512, 100)
setSpritePosition(id3, 0, 0)
setSpriteZOrder(id3, 3)
setSpriteIndependentCamera(id3, true)

id4 = createSprite(247580)
setSpriteRect(id4, 0, 0, 512, 70, 0, 0, 512, 70)
setSpritePosition(id4, 0, 0)
setSpriteZOrder(id4, 1)
setSpriteIndependentCamera(id4, true)

id5 = createSprite(263553)
setSpriteRect(id5, 0, 0, 150, 70, 0, 0, 150, 70)
setSpritePosition(id5, 15, 0)
setSpriteZOrder(id5, 2)
setSpriteIndependentCamera(id5, true)

id6 = createSprite(263560)
setSpriteRect(id6, 0, 0, 150, 51, 0, 0, 150, 51)
setSpritePosition(id6, 340, 0)
setSpriteZOrder(id6, 2)
setSpriteIndependentCamera(id6, true)



drawCanvas()

#BBAの表示位置に関する変数
bx=224
lrx=258
llx=244
BBAB=createSprite(258255)
setSpriteRect(BBAB, 0, 0, 60, 65, 0, 0, 60, 65)
setSpritePosition(BBAB, 224,300)
setSpriteZOrder(BBAB, 5)
setSpriteIndependentCamera(BBAB, true)

BBALR=createSprite(258287)
setSpriteRect(BBALR, 32, 53, 12, 13, 0, 0, 12, 13)
setSpritePosition(BBALR, 258, 353)
setSpriteZOrder(BBALR, 4)
setSpriteIndependentCamera(BBALR, true)

createSprite(258287)
BBALL=createSprite(258287)
setSpriteRect(BBALL, 21,55, 9, 10, 0, 0, 9, 10)
setSpritePosition(BBALL, 244, 355)
setSpriteZOrder(BBALL, 5)
setSpriteIndependentCamera(BBALL, true)

car1=createSprite(259505)
setSpriteRect(car1, 0, 0, 120, 65, 0, 0, 120, 65)
setSpriteScale(car1,0,0)
setSpriteZOrder(car1, 3)

car2=createSprite(259505)
setSpriteRect(car2, 0, 0, 120, 65, 0, 0, 120, 65)
setSpriteScale(car2,0,0)
setSpriteZOrder(car2, 3)

car3=createSprite(259505)
setSpriteRect(car3, 0, 0, 120, 65, 0, 0, 120, 65)
setSpriteScale(car3,0,0)
setSpriteZOrder(car3, 3)

#入力関連の下準備
setFlag("up",false)
setFlag("down",false)
setFlag("right",false)
setFlag("left",false)

#カメラの位置設定
camx=0
camy=0

startInput()

i = 0
j=0
v=0
bj=0
phase=0

#BBAの変数
pos_bba=2
vmax=150


#車の変数周り
zoc=3

em_car1=0
p_c1=0;q_c1=-1
phase_c1=0
pos_car1=0

em_car2=0
p_c2=0;q_c2=-1
phase_c2=0
pos_car2=0

em_car3=0
p_c3=0;q_c3=-1
phase_c3=0
pos_car3=0
#テキスト表示領域を用意します。
textID = createText(10, 20, 512, 64)

score=0
point=0

while loop

  #入力が入っているかどうか調べます。
  if hasInput()
    #内部にたまっている入力を処理対象とします。
    takeInput()

    if isKeyDown("UP")
      setFlag("up",true)
    elsif isKeyUp("UP")
      setFlag("up",false)
    elsif isKeyDown("RIGHT")
      setFlag("right",true)
    elsif isKeyUp("RIGHT")
      setFlag("right",false)
    elsif isKeyDown("LEFT")
      setFlag("left",true)
    elsif isKeyUp("LEFT")
      setFlag("left",false)
    elsif isKeyUp("Z")&&v==vmax
      if vmax<250
        vmax=vmax+50
        playSound(146233)
     end
   end  
  end

   if  v<vmax
     v=v+1
   end

   ste=0.0006*v*v+0.0041*v+3
   vapp=0.003*ste*ste*ste-0.209*ste*ste+5.4*ste-30.7 
  if getFlag("right")
    if  bx<452-ste
      bx=bx+ste
      lrx=lrx+ste
      llx=llx+ste
      setSpritePosition(BBAB, bx,300)
      setSpritePosition(BBALR, lrx,353)
      setSpritePosition(BBALL, llx,355)
    end
  elsif getFlag("left")
    if  bx>ste
      bx=bx-ste
      lrx=lrx-ste
      llx=llx-ste
      setSpritePosition(BBAB, bx,300)
      setSpritePosition(BBALR, lrx,353)
      setSpritePosition(BBALL, llx,355)
    end
  end

  if getFlag("up")
    if getFlag("jump")
    else
      setFlag("jump",true)
      j=0
      radj=0
      playSound(30713)
    end
  end

  if  getFlag("jump")
    if j<25
      j=j+1
      setSpriteCameraPosition(0, -sin(0.04*j*pi())*100)
      bj=floor(0.5+sin(0.04*j*pi()))*10
    else
      setFlag("jump",false)
    end
  end

  if em_car1+em_car2+em_car3<2
    case  rand(6)
       when 0
           em_car1=1;
       when 1
           em_car2=1;
       when 2
           em_car3=1;
       end
  end

  phase=phase+pi()*0.004*v
  p=-sin(phase)
  q=-cos(phase)

  rad=atan2(p,q)+pi()
  
  setSpritePosition(line1,0 ,226+tan(rad*0.125)*10)
  setSpritePosition(line2,0 ,240+tan(rad*0.125+pi()*0.25*0.125)*20)
  setSpritePosition(line3,0 ,264+tan(rad*0.125+pi()*0.5*0.125)*40)
  setSpritePosition(line4,0 ,304+tan(rad*0.125+pi()*0.75*0.125)*80)


  setSpriteScale(BBALR, 1, (sin(rad)+1)*0.5)
  setSpriteScale(BBALL, 1, (-sin(rad)+1)*0.5)
 
     phase_c1=(phase_c1+pi()*0.004*0.6*vapp)*em_car1
     p_c1=-sin(phase_c1)
     q_c1=-cos(phase_c1)
     setSpritePosition(car1, 220-200*tan((atan2(p_c1,q_c1)+pi())*0.25) ,94*tan((atan2(p_c1,q_c1)+pi())*0.25) +226)
     setSpriteScale(car1,tan((atan2(p_c1,q_c1)+pi())*0.25) ,tan((atan2(p_c1,q_c1)+pi())*0.25) )
     setSpriteZOrder(car1, zoc+4*floor(tan((atan2(p_c1,q_c1)+pi())*0.25)*1.2)*em_car1)

     phase_c2=(phase_c2+pi()*0.004*0.6*vapp)*em_car2 
     p_c2=-sin(phase_c2)
     q_c2=-cos(phase_c2)
     setSpritePosition(car2, 255-55*tan((atan2(p_c2,q_c2)+pi())*0.25) ,94*tan((atan2(p_c2,q_c2)+pi())*0.25) +226)
     setSpriteScale(car2,tan((atan2(p_c2,q_c2)+pi())*0.25) ,tan((atan2(p_c2,q_c2)+pi())*0.25) )
     setSpriteZOrder(car2, zoc+4*floor(tan((atan2(p_c2,q_c2)+pi())*0.25)*1.2)*em_car2)
     phase_c3=(phase_c3+pi()*0.004*0.6*vapp)*em_car3
     p_c3=-sin(phase_c3)
     q_c3=-cos(phase_c3)
     setSpritePosition(car3, 280+80*tan((atan2(p_c3,q_c3)+pi())*0.25) ,94*tan((atan2(p_c3,q_c3)+pi())*0.25) +226)
     setSpriteScale(car3,tan((atan2(p_c3,q_c3)+pi())*0.25) ,tan((atan2(p_c3,q_c3)+pi())*0.25) )
     setSpriteZOrder(car3, zoc+4*floor(tan((atan2(p_c3,q_c3)+pi())*0.25)*1.2)*em_car3)

 if  94*tan((atan2(p_c1,q_c1)+pi())*0.25)+226>380||tan((atan2(p_c1,q_c1)+pi())*0.25)<0
    em_car1=0
  end
if  94*tan((atan2(p_c2,q_c2)+pi())*0.25)+226>380||tan((atan2(p_c2,q_c2)+pi())*0.25)<0
    em_car2=0
  end
if  94*tan((atan2(p_c3,q_c3)+pi())*0.25)+226>380||tan((atan2(p_c3,q_c3)+pi())*0.25)<0
    em_car3=0
  end


  #あたり判定に関する部分
  pos_bba=floor(bx/150)+1+bj
  pos_car1=tan((atan2(p_c1,q_c1)+pi())*0.25)*94+226
  pos_car2=tan((atan2(p_c2,q_c2)+pi())*0.25)*94+226
  pos_car3=tan((atan2(p_c3,q_c3)+pi())*0.25)*94+226

  if pos_car1>295&&pos_car1<318
    pos_car1=1
  else
    pos_car1=0
  end

  if pos_car2>295&&pos_car2<318
    pos_car2=2
  else
    pos_car2=0
  end

  if pos_car3>295&&pos_car3<318
    pos_car3=3
  else
    pos_car3=0
  end
 point=0
 if pos_bba==pos_car1||pos_bba==pos_car2||pos_bba==pos_car3
    shakeScreen(100)
    playSound(86367)
    vmax=150
    i=i+v*2
    v=0
  elsif pos_bba==pos_car1+10||pos_bba==pos_car2+10||pos_bba==pos_car3+10
    point=100000
  end
score=score+floor(v*0.01)*100+point
setSpriteScale(id5,v*0.004 ,1 )
setSpriteScale(id6,1-i/3000 ,1 )
  drawCanvas()
  i = i+1 
  if i > 3000
    loop = false
    setFlag("end",true)
  end
  waitTime(10)
end

deleteAllSprite()

setVariable("score",score)
setFlag("end",true)
setSpriteCameraPosition(0, 0)

コメントの内容(一番最初の投稿)

User icon mini taki(投稿日:2014/11/16 00:11/16/14)
ここ独り占め
今回使ったメインのスクリプト
loop = true
setBaseTime()

setCanvasVisible(true)

line0 = createSprite(247580)
setSpriteRect(line0, 0, 0, 512, 4, 0, 0, 512, 4)
setSpritePosition(line0,0 ,224)

line1 = createSprite(247580)
setSpriteRect(line1, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line1, 2)

line2 = createSprite(247580)
setSpriteRect(line2, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line2, 2)

line3 = createSprite(247580)
setSpriteRect(line3, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line3, 2)

line4 = createSprite(247580)
setSpriteRect(line4, 0, 0, 512, 4, 0, 0, 512, 4)
setSpriteZOrder(line4, 2)

id2 = createSprite(255327)
setSpriteRect(id2, 0, 0, 512, 384, 0, 0, 512, 384)
setSpritePosition(id2, 0, 0)
drawCanvas()
speak("Please Push Z key to Start")
case rand(3)
   when 0
     playBGM(189465)
   when 1
     playBGM(257118)
   when 2
      playBGM(262837)
end

id3 = createSprite(263468)
setSpriteRect(id3, 0, 0, 512, 100, 0, 0, 512, 100)
setSpritePosition(id3, 0, 0)
setSpriteZOrder(id3, 3)
setSpriteIndependentCamera(id3, true)

id4 = createSprite(247580)
setSpriteRect(id4, 0, 0, 512, 70, 0, 0, 512, 70)
setSpritePosition(id4, 0, 0)
setSpriteZOrder(id4, 1)
setSpriteIndependentCamera(id4, true)

id5 = createSprite(263553)
setSpriteRect(id5, 0, 0, 150, 70, 0, 0, 150, 70)
setSpritePosition(id5, 15, 0)
setSpriteZOrder(id5, 2)
setSpriteIndependentCamera(id5, true)

id6 = createSprite(263560)
setSpriteRect(id6, 0, 0, 150, 51, 0, 0, 150, 51)
setSpritePosition(id6, 340, 0)
setSpriteZOrder(id6, 2)
setSpriteIndependentCamera(id6, true)



drawCanvas()

#BBAの表示位置に関する変数
bx=224
lrx=258
llx=244
BBAB=createSprite(258255)
setSpriteRect(BBAB, 0, 0, 60, 65, 0, 0, 60, 65)
setSpritePosition(BBAB, 224,300)
setSpriteZOrder(BBAB, 5)
setSpriteIndependentCamera(BBAB, true)

BBALR=createSprite(258287)
setSpriteRect(BBALR, 32, 53, 12, 13, 0, 0, 12, 13)
setSpritePosition(BBALR, 258, 353)
setSpriteZOrder(BBALR, 4)
setSpriteIndependentCamera(BBALR, true)

createSprite(258287)
BBALL=createSprite(258287)
setSpriteRect(BBALL, 21,55, 9, 10, 0, 0, 9, 10)
setSpritePosition(BBALL, 244, 355)
setSpriteZOrder(BBALL, 5)
setSpriteIndependentCamera(BBALL, true)

car1=createSprite(259505)
setSpriteRect(car1, 0, 0, 120, 65, 0, 0, 120, 65)
setSpriteScale(car1,0,0)
setSpriteZOrder(car1, 3)

car2=createSprite(259505)
setSpriteRect(car2, 0, 0, 120, 65, 0, 0, 120, 65)
setSpriteScale(car2,0,0)
setSpriteZOrder(car2, 3)

car3=createSprite(259505)
setSpriteRect(car3, 0, 0, 120, 65, 0, 0, 120, 65)
setSpriteScale(car3,0,0)
setSpriteZOrder(car3, 3)

#入力関連の下準備
setFlag("up",false)
setFlag("down",false)
setFlag("right",false)
setFlag("left",false)

#カメラの位置設定
camx=0
camy=0

startInput()

i = 0
j=0
v=0
bj=0
phase=0

#BBAの変数
pos_bba=2
vmax=150


#車の変数周り
zoc=3

em_car1=0
p_c1=0;q_c1=-1
phase_c1=0
pos_car1=0

em_car2=0
p_c2=0;q_c2=-1
phase_c2=0
pos_car2=0

em_car3=0
p_c3=0;q_c3=-1
phase_c3=0
pos_car3=0
#テキスト表示領域を用意します。
textID = createText(10, 20, 512, 64)

score=0
point=0

while loop

  #入力が入っているかどうか調べます。
  if hasInput()
    #内部にたまっている入力を処理対象とします。
    takeInput()

    if isKeyDown("UP")
      setFlag("up",true)
    elsif isKeyUp("UP")
      setFlag("up",false)
    elsif isKeyDown("RIGHT")
      setFlag("right",true)
    elsif isKeyUp("RIGHT")
      setFlag("right",false)
    elsif isKeyDown("LEFT")
      setFlag("left",true)
    elsif isKeyUp("LEFT")
      setFlag("left",false)
    elsif isKeyUp("Z")&&v==vmax
      if vmax<250
        vmax=vmax+50
        playSound(146233)
     end
   end  
  end

   if  v<vmax
     v=v+1
   end

   ste=0.0006*v*v+0.0041*v+3
   vapp=0.003*ste*ste*ste-0.209*ste*ste+5.4*ste-30.7 
  if getFlag("right")
    if  bx<452-ste
      bx=bx+ste
      lrx=lrx+ste
      llx=llx+ste
      setSpritePosition(BBAB, bx,300)
      setSpritePosition(BBALR, lrx,353)
      setSpritePosition(BBALL, llx,355)
    end
  elsif getFlag("left")
    if  bx>ste
      bx=bx-ste
      lrx=lrx-ste
      llx=llx-ste
      setSpritePosition(BBAB, bx,300)
      setSpritePosition(BBALR, lrx,353)
      setSpritePosition(BBALL, llx,355)
    end
  end

  if getFlag("up")
    if getFlag("jump")
    else
      setFlag("jump",true)
      j=0
      radj=0
      playSound(30713)
    end
  end

  if  getFlag("jump")
    if j<25
      j=j+1
      setSpriteCameraPosition(0, -sin(0.04*j*pi())*100)
      bj=floor(0.5+sin(0.04*j*pi()))*10
    else
      setFlag("jump",false)
    end
  end

  if em_car1+em_car2+em_car3<2
    case  rand(6)
       when 0
           em_car1=1;
       when 1
           em_car2=1;
       when 2
           em_car3=1;
       end
  end

  phase=phase+pi()*0.004*v
  p=-sin(phase)
  q=-cos(phase)

  rad=atan2(p,q)+pi()
  
  setSpritePosition(line1,0 ,226+tan(rad*0.125)*10)
  setSpritePosition(line2,0 ,240+tan(rad*0.125+pi()*0.25*0.125)*20)
  setSpritePosition(line3,0 ,264+tan(rad*0.125+pi()*0.5*0.125)*40)
  setSpritePosition(line4,0 ,304+tan(rad*0.125+pi()*0.75*0.125)*80)


  setSpriteScale(BBALR, 1, (sin(rad)+1)*0.5)
  setSpriteScale(BBALL, 1, (-sin(rad)+1)*0.5)
 
     phase_c1=(phase_c1+pi()*0.004*0.6*vapp)*em_car1
     p_c1=-sin(phase_c1)
     q_c1=-cos(phase_c1)
     setSpritePosition(car1, 220-200*tan((atan2(p_c1,q_c1)+pi())*0.25) ,94*tan((atan2(p_c1,q_c1)+pi())*0.25) +226)
     setSpriteScale(car1,tan((atan2(p_c1,q_c1)+pi())*0.25) ,tan((atan2(p_c1,q_c1)+pi())*0.25) )
     setSpriteZOrder(car1, zoc+4*floor(tan((atan2(p_c1,q_c1)+pi())*0.25)*1.2)*em_car1)

     phase_c2=(phase_c2+pi()*0.004*0.6*vapp)*em_car2 
     p_c2=-sin(phase_c2)
     q_c2=-cos(phase_c2)
     setSpritePosition(car2, 255-55*tan((atan2(p_c2,q_c2)+pi())*0.25) ,94*tan((atan2(p_c2,q_c2)+pi())*0.25) +226)
     setSpriteScale(car2,tan((atan2(p_c2,q_c2)+pi())*0.25) ,tan((atan2(p_c2,q_c2)+pi())*0.25) )
     setSpriteZOrder(car2, zoc+4*floor(tan((atan2(p_c2,q_c2)+pi())*0.25)*1.2)*em_car2)
     phase_c3=(phase_c3+pi()*0.004*0.6*vapp)*em_car3
     p_c3=-sin(phase_c3)
     q_c3=-cos(phase_c3)
     setSpritePosition(car3, 280+80*tan((atan2(p_c3,q_c3)+pi())*0.25) ,94*tan((atan2(p_c3,q_c3)+pi())*0.25) +226)
     setSpriteScale(car3,tan((atan2(p_c3,q_c3)+pi())*0.25) ,tan((atan2(p_c3,q_c3)+pi())*0.25) )
     setSpriteZOrder(car3, zoc+4*floor(tan((atan2(p_c3,q_c3)+pi())*0.25)*1.2)*em_car3)

 if  94*tan((atan2(p_c1,q_c1)+pi())*0.25)+226>380||tan((atan2(p_c1,q_c1)+pi())*0.25)<0
    em_car1=0
  end
if  94*tan((atan2(p_c2,q_c2)+pi())*0.25)+226>380||tan((atan2(p_c2,q_c2)+pi())*0.25)<0
    em_car2=0
  end
if  94*tan((atan2(p_c3,q_c3)+pi())*0.25)+226>380||tan((atan2(p_c3,q_c3)+pi())*0.25)<0
    em_car3=0
  end


  #あたり判定に関する部分
  pos_bba=floor(bx/150)+1+bj
  pos_car1=tan((atan2(p_c1,q_c1)+pi())*0.25)*94+226
  pos_car2=tan((atan2(p_c2,q_c2)+pi())*0.25)*94+226
  pos_car3=tan((atan2(p_c3,q_c3)+pi())*0.25)*94+226

  if pos_car1>295&&pos_car1<318
    pos_car1=1
  else
    pos_car1=0
  end

  if pos_car2>295&&pos_car2<318
    pos_car2=2
  else
    pos_car2=0
  end

  if pos_car3>295&&pos_car3<318
    pos_car3=3
  else
    pos_car3=0
  end
 point=0
 if pos_bba==pos_car1||pos_bba==pos_car2||pos_bba==pos_car3
    shakeScreen(100)
    playSound(86367)
    vmax=150
    i=i+v*2
    v=0
  elsif pos_bba==pos_car1+10||pos_bba==pos_car2+10||pos_bba==pos_car3+10
    point=100000
  end
score=score+floor(v*0.01)*100+point
setSpriteScale(id5,v*0.004 ,1 )
setSpriteScale(id6,1-i/3000 ,1 )
  drawCanvas()
  i = i+1 
  if i > 3000
    loop = false
    setFlag("end",true)
  end
  waitTime(10)
end

deleteAllSprite()

setVariable("score",score)
setFlag("end",true)
setSpriteCameraPosition(0, 0)