-
ช่วยแนะนำหน่อยคะ
คือว่า เรากำลังทำโปรเจค เขียนเกมส์เก็บผลไม้ แบบ ตามลิงค์ นี่อ่ะคะ
http://game.siamha.com/name/storefruit/
แล้วที่นี่ เราทำได้ถึงตรงที่ว่า ให้ผลไม้ตกลงมา แต่ว่า
ที่เราเขียนค้างไว้ มันตกลงมาพร้อมกันหมด แล้วตกลงมาแค่ครั้งเดียว แล้วหยุดเลย
เราต้องการ ให้มัน ต้องลงมาเรื่อยๆ และ ไม่พร้อมกันอะ
โค้ดของเรา ตรงส่วนที่เราใส่ผลไม้ เข้าไปก็ประมาณนี้นะคะ
GameLog::GameLogControl.DoLog("Load background completed");
if(c1.OnLoad("image\\item1.bmp",77,80,0)== NULL)// sai ta ka
{
GameLog::GameLogControl.DoLog(SDL_GetError());
return false;
}
c1.Flag() = ENTITY_FLAG_NONE;
c1.X() = 320;
c1.Y() = 400;
if(fr.OnLoad("image\\item2.bmp",77,80,0)== NULL)// Strawberry
{
GameLog::GameLogControl.DoLog(SDL_GetError());
return false;
}
fr.Flag() = ENTITY_FLAG_GRAVITY;
fr.X() = rand()%400;
fr.Y() = 100;
fr.AccelY() = 200;
fr.MoveDown() = true;
if(fr2.OnLoad("image\\item3.bmp",77,80,0)== NULL)// Pineapple
{
GameLog::GameLogControl.DoLog(SDL_GetError());
return false;
}
fr2.Flag() = ENTITY_FLAG_GRAVITY;
fr2.X() = 220;
fr2.Y() = 100;
fr2.AccelY() = 500;
fr2.MoveDown() = true;
if(fr3.OnLoad("image\\item4.bmp",77,80,0)== NULL)// Orange
{
GameLog::GameLogControl.DoLog(SDL_GetError());
return false;
}
fr3.Flag() = ENTITY_FLAG_GRAVITY;
fr3.X() = rand()%400;
fr3.Y() = 100;
fr3.AccelY() = 200;
fr3.MoveDown() = true;
if(fr4.OnLoad("image\\item5.bmp",77,80,0)== NULL)// Apple
{
GameLog::GameLogControl.DoLog(SDL_GetError());
return false;
}
fr4.Flag() = ENTITY_FLAG_GRAVITY;
fr4.X() = 450;
fr4.Y() = 100;
fr4.AccelY() = 120;
fr4.MoveDown() = true;
if(fr5.OnLoad("image\\item6.bmp",77,80,0)== NULL)// Cherry
{
GameLog::GameLogControl.DoLog(SDL_GetError());
return false;
}
fr5.Flag() = ENTITY_FLAG_GRAVITY;
fr5.X() = 500;
fr5.Y() = 100;
fr5.AccelY() = 170;
fr5.MoveDown() = true;
แล้วตรงนี้ อาจารย์เค้าแนะนำว่า ให้เขียนเป็น Array เพื่อให้มันตกลงมาเรื่อยๆ แต่เราไม่รู้จะเขียนยังไงต่ออะคะ
MyFruit fr;
MyFruit fr2;
MyFruit fr3;
MyFruit fr4;
MyFruit fr5;
รบกวนช่วยทีนะคะ ขอบคุณมากคะ
-
ลองดูใน google ดูครับ เกี่ยวกับ ภาษาC, C#
จาก Dream-Colo
สำหรับผู้ต้องการดาวน์โหลดแรงๆ Dream-colo.comให้บริการโหลด บิทโคโล แรง เสถียร ราคาถูกเริ่มต้นเพียง130บาท ขอทดสอบDemo โคโลฟรี
หน้าเว็บโคโล ส่วนต่างๆ ของ ดรีมโคโล, Dream-Colo.com
หน้าหลัก ดรีมโคโล, http://www.dream-colo.com/
สมัครโคโลออนไลน์, http://www.dream-colo.com/online-register/
โคโลแพ็คเก็จ & Colo Services, http://www.dream-colo.com/package-service/
การชำระเงิน, http://www.dream-colo.com/payment/
ติดต่อสอบถาม, http://www.dream-colo.com/contact-us/
โปรโมชั่นสุดคุ้ม, http://www.dream-colo.com/promotion-colo/
คู่มือการใช้โคโล, http://www.dream-colo.com/colo-user-guide/
เนื้อหาทั่วไป, http://www.dream-colo.com/web-content/
สามารถติดต่อสอบถาม การเช่าโคโล หรือทดสอบDemo โคโลฟรี ได้ที่เว็บไซต์ ของดรีมโคโล
Facebook Comments
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules