AS ตอนที 3:วิ่งยาวๆกับ enterFrame

เริ่มโพสต์โดย X Saint, 06 พ.ค. 2006, 07:20 น.

0 สมาชิก และ 1 บุคคลทั่วไป กำลังเปิดอ่านโพสต์นี้

icez

#15
code ยาวเฟื้อยยยย
btnYellow.onRelease = function() {
i = 0;
circle.onEnterFrame = function() {
if (i < 100) {
circle._x ++;
if (circle._x >= 300)
circle._x = 0;
if (circle._x < 0)
circle._x += 300;
i++;
} else {
delete circle.onEnterFrame;
}
}
}
btnBlue.onRelease = function() {
i = 0;
circle.onEnterFrame = function() {
if (i < 100) {
circle._y ++;
if (circle._y >= 300)
circle._y = 0;
if (circle._y < 0)
circle._y += 300;
i++;
} else {
delete circle.onEnterFrame;
}
}
}
btnRed.onRelease = function() {
if (i > 0 && i < 100)
delete circle.onEnterFrame;
}
btnGreen.onRelease = function() {
i = 0;
circle.onEnterFrame = function() {
if (i < 100) {
circle._y++;
circle._x += 20 * Math.sin(circle._y);
if (circle._y >= 300)
circle._y = 0;
if (circle._x >= 300)
circle._x = 0;
if (circle._y < 0)
circle._y += 300;
if (circle._x < 0)
circle._x += 300;
i++;
} else {
delete circle.onEnterFrame;
}
}
}
btnOrange.onRelease = function() {
i = 0;
circle.onEnterFrame = function() {
if (i < 100) {
circle._x++;
circle._y += 20 * Math.sin(circle._x);
if (circle._x >= 300)
circle._x = 0;
if (circle._y >= 300)
circle._y = 0;
if (circle._y < 0)
circle._y += 300;
if (circle._x < 0)
circle._x += 300;
i++;
} else {
delete circle.onEnterFrame;
}
}
}


เอาไว้... เอ่อ... การบ้านข้อ 2 แล้วกันนะครับ จะได้ทำลูกเล่นอะไรนิดหน่อย
เพิ่งเคยใช้ flash จริงๆ นะ จิ้มเล่นมาไม่กี่ครั้งเอง นอกจากใส่เพลง กับใส่วีดีโอ ก็ไอเนี้ย อีกอัน

X Saint

อ้างคำพูดจาก: เต่า เมื่อ 06 พ.ค. 2006, 13:19 น.
โอ้ว... มันส์...

http://f0nt.com/forum/index.php?action=dlattach;topic=5925.0;id=9199

แค่วางจุดหมุนไว้ที่ปีกครับ ไม่ต้องใช้สติปัญญาอะไรเลย  :08:

นอกจาก _rotation

เดินเหมือนสัตว์ประหลาดในเกม Spore

แต่ไหนปุ่ม  :31:

♥ ชายเต่า ♥

การบ้านไว้ก่อนครับ  :42:
เอามั่ง

saa3

อยากเล่น Spore  :42:
(เกมนี้ ผมซื้อแผ่นแท้นะครับลุงท็อป)

เต่าแปะโค้ดบ้างสิ  :42:

X Saint

อ้างคำพูดจาก: Saa3 เมื่อ 06 พ.ค. 2006, 13:27 น.
อยากเล่น Spore  :42:
(เกมนี้ ผมซื้อแผ่นแท้นะครับลุงท็อป)


ปีหน้าแหน่ะ... (ไม่แน่ว่าจะออกทัน)
เห็นบักตรึม โชว์ทุกที crash ทุกที  :42:

saa3

อ้างคำพูดจาก: X Saint เมื่อ 06 พ.ค. 2006, 13:31 น.
ปีหน้าแหน่ะ... (ไม่แน่ว่าจะออกทัน)
เห็นบักตรึม โชว์ทุกที crash ทุกที  :42:

:08:

แต่ตัวเกมโคตรเจ๋งเลยครับ ลุง Will ก็เล่นแม่ม  :30:

(เข้าเรื่อง เดี๋ยวค่อยทำการบ้านมาส่งครับ :31:)

Zafire06

โอ้วววอ้าวววส์  :04:
ฟังก์ชั่นได้ด้วยยย  :04:

L

แล้วที่ว่างของผุ้ที่พิการทางคณิตศาสตร์อย่างผมหายไปไหนครับ  :39:

ปล จะพยายาม ลอกมาให้สำเร้จครับ แต่ตอนนี้ปวดหัวมากหลังจากอ่านคำว่า สมการ :08:
เกะกะ ระราน พาลไม่เลือกสถานที่

แมวเงียบ

เริ่มอ่านไม่รุ้เรื่องตั้งแต่สมการ sin แล้วค่ะ
แย่แล้ว
เลขกิพแย่ไงแย่งั้นมาตลอดเลยแฮะ
ตั้งแต่ประถมจน stat ตัวสุดท้ายที่เพิ่งจบไปนี่แหละ :08:


ปล. ยังไม่มีไอเดียการบ้านค่ะ

X Saint

 :08: อย่าไปดู พวก sin ครับ อันนั้นไม่เกี่ยวอ่ะคับ แค่ให้ดูเฉยๆว่ามันใช้สมการมาเล่นอะไรสนุกๆได้นะ
ดูเฉพาะส่วนที่ 1 กับ 2 ที่อธิบายการเขียน onEnterFrame ก็พอครับ... เพราะเดี๋ยวตอนเอาไปแก้โจทย์ ขยับกรอบ... มันก็ไม่ได้ใช้สมการ sin cos tan น่อ

:05: รู้งี้ไม่ใส่ไปดีกว่า....  :08:

i-poon

มาแล้วครับการบ้าน นั่งช่วยกันทำกับน้อง 2 คน
http://upload.i-poon.com/flash/gun.swf

อันนี้ code
อ้างอิง
//condition var
intSpeed=70;
angle=-45;
showAngle=angle*(-1);
gun._rotation=angle;
obj._rotation=angle;



//control Panel

butUp.onPress=function(){
   _root.onEnterFrame=function(){
      if(intSpeed<200){         
         intSpeed+=2;
      }
   }
}
butUp.onRelease=function(){
   delete _root.onEnterFrame;
}
butUp.onDragOut=function(){
   delete _root.onEnterFrame;
}

butDown.onPress=function(){
   _root.onEnterFrame=function(){
      if(intSpeed>40){         
         intSpeed-=2;
      }
   }
}
butDown.onRelease=function(){
   delete _root.onEnterFrame;
}
butDown.onDragOut=function(){
   delete _root.onEnterFrame;
}

butPowerUp.onPress=function(){
   _root.onEnterFrame=function(){
      if(angle>-90){         
         angle-=1;
         showAngle=angle*(-1);
         gun._rotation=angle;
         obj._rotation=angle;
      }
   }
}
butPowerUp.onRelease=function(){
   delete _root.onEnterFrame;
}
butPowerUp.onDragOut=function(){
   delete _root.onEnterFrame;
}

butPowerDown.onPress=function(){
   _root.onEnterFrame=function(){
      if(angle<0){         
         angle+=1;
         showAngle=angle*(-1);
         gun._rotation=angle;
         obj._rotation=angle;
      }
   }
}
butPowerDown.onRelease=function(){
   delete _root.onEnterFrame;
}
butPowerDown.onDragOut=function(){
   delete _root.onEnterFrame;
}

//projectile var
gravity=10;
time=0;
obj.xInt=obj._x;
obj.yInt=obj._y;

//projectile process
butt.onRelease=function(){
   rAngle=angle*(Math.PI/180);
   xIntSpeed=intSpeed*Math.cos(rAngle);
   yIntSpeed=intSpeed*Math.sin(rAngle);
   obj.onEnterFrame=function(){
         time+=(1/3);         
         obj.xTile=xIntSpeed*time;
         obj.yTile=(yIntSpeed*time)+((0.5)*gravity*time*time);
         obj._x=obj.xInt+obj.xTile;
         obj._y=obj.yInt+obj.yTile;
         obj._rotation+=15;
         if(obj._y>=620 || obj._x>=1120){
            time=0;
            obj._x=obj.xInt;
            obj._y=obj.yInt;
            delete obj.onEnterFrame;
            obj._rotation=angle;
         }
   }
}
50 levels avaliable, 22 secrets levels avaliable :P

✌

เวลายิงแรงๆไปท้องฟ้า90องศาต้องรอลูกบอลตกลงมาก่อนค่อยกดอีกลูก  :08:

♥ ชายเต่า ♥

เอามั่ง

i-poon

อ้างคำพูดจาก: Bot.net เมื่อ 07 พ.ค. 2006, 08:35 น.
เวลายิงแรงๆไปท้องฟ้า90องศาต้องรอลูกบอลตกลงมาก่อนค่อยกดอีกลูก  :08:

คนจริง ใจต้องนิ่งครับ  :35:
50 levels avaliable, 22 secrets levels avaliable :P

X Saint

กลายเป็นโปรเจ็คไตลไปซะงั้น  :31:

SMF 2.1.7 © 2026, Simple Machines