ผลต่างระหว่างรุ่นของ "418383/418587 ภาคปลาย 2553/คะแนนการบ้าน 2"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
 
(ไม่แสดง 25 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
แถว 1: แถว 1:
 
== คะแนน ==
 
== คะแนน ==
 
=== คนที่ไม่ได้ 0 คะแนน ===
 
=== คนที่ไม่ได้ 0 คะแนน ===
 +
* 47180278 ได้ 83 คะแนน
 +
** -5 for only adding one ball
 +
** -5 for not shooting the ball immediately
 +
** -5 for shooting only one bullet
 +
** -2 for having no music when the player clears a stage
 +
* 51180198 ได้ 100 คะแนน
 +
* 51180248 ได้ 100 คะแนน
 +
* 5210400425 ได้ 100 คะแนน
 +
* 5210400514 ได้ 93 คะแนน
 +
** -2 for no background music"
 +
** -5 for not changing the background image
 +
* 5210404889 ได้ 100 คะแนน
 +
* 5210404897 ได้ 98 คะแนน
 +
** -2 for not having music when player clears a stage
 +
* 5210405036 ได้ 98 คะแนน
 +
** -2 for not having music when player clears a stage
 +
* 5210450937 ได้ 94 คะแนน
 +
** -2 for no sound when bar hits wall
 +
** -2 for no sound when bar dies
 +
** -2 for not playing a song when the player clears a stage
 +
* 5210450562 ได้ 100 คะแนน
 +
 
=== คนที่ได้ 0 คะแนนเนื่องจากลอกเพื่อนหรือให้เพื่อนลอก ===
 
=== คนที่ได้ 0 คะแนนเนื่องจากลอกเพื่อนหรือให้เพื่อนลอก ===
 +
* 51180537
 +
* 51180628
 +
* 51180727
 +
* 51180644
 +
* 5210400433
 +
* 5210404803
 +
* 5210450040
 +
* 5210450058
 +
* 5210450104
 +
* 5210450147
 +
* 5210450597
  
=== การลอกกันที่ผมจับได้ ===
+
== การลอกกันที่ผมจับได้ ==
==== โค้ดเปลี่ยนด่านใน PlayScreen.cs ====
+
=== โค้ดเปลี่ยนด่านใน PlayScreen.cs ===
 
<table>
 
<table>
 
<tr>
 
<tr>
แถว 137: แถว 170:
 
[[ไฟล์:Breakout-playscreen-51180537-51180644.JPG|300px]]
 
[[ไฟล์:Breakout-playscreen-51180537-51180644.JPG|300px]]
  
=== โค้ด LoadContent ใน PlayScreen.cs ===
+
=== Bullet.cs (Pattern 1) ===
* 5210400433 กับ 5210404803
+
นิสิตหลายคนทำการคัดลอก Ball.cs มาเป็น Bullet.cs (47180278, 51180248, 5210404889, 5210404897, 5210400425, และ 5210405036) นี่ไม่นับเป็นการลอกเนื่องจากเป็นการใช้โค้ดเก่าของอาจารย์ อย่างไรก็ดีโค้ดของนิสิต 7 คนข้างล่างนี้มีลักษณะเด่นเหมือนๆ กัน ดังต่อไปนี้ คือ
[[ไฟล์:Breakout-playscreen-5210400433-5210404803.JPG|300px]]
 
 
 
=== Bullet.cs ===
 
นิสิตส่วนใหญ่ทำการคัดลอก Ball.cs มาเป็น Bullet.cs นี่ไม่นับเป็นการลอกเนื่องจากเป็นการใช้โค้ดเก่าของอาจารย์ อย่างไรก็ดีโค้ดของนิสิต 7 คนข้างล่างนี้มีลักษณะเด่นเหมือนๆ กัน ดังต่อไปนี้ คือ
 
 
* เหลือเมธอด CollideOnTopSurface และ ColildeOnButtomSurface ไว้ ไม่คง CollideOnLeftSurface  และ CollideOnRightSurface ของ Ball.cs เดิมไว้
 
* เหลือเมธอด CollideOnTopSurface และ ColildeOnButtomSurface ไว้ ไม่คง CollideOnLeftSurface  และ CollideOnRightSurface ของ Ball.cs เดิมไว้
 
* กำหนดให้ Bullet มีขนาด 5 x 5 ช่องเหมือนๆ กัน
 
* กำหนดให้ Bullet มีขนาด 5 x 5 ช่องเหมือนๆ กัน
แถว 477: แถว 506:
 
</geshi>
 
</geshi>
 
</td>
 
</td>
</tr>
 
</table>
 
 
==== อีกรูปแบบหนึ่งที่คล้ายๆ กัน ====
 
<table>
 
<tr>
 
<td align="center">5210450040</td>
 
<td align="center">5210450104</td>
 
<td align="center">5210450562</td>
 
<td align="center">5210450937</td>
 
</tr>
 
<tr>
 
 
<td>
 
<td>
 
<geshi lang="csharp">
 
<geshi lang="csharp">
แถว 498: แถว 515:
 
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework.Content;
 
using Microsoft.Xna.Framework.Content;
 
  
 
namespace BreakoutLib
 
namespace BreakoutLib
แถว 522: แถว 538:
 
             get { return animation.Displacement; }
 
             get { return animation.Displacement; }
 
         }
 
         }
 
+
       
 +
     
 
         public Rectangle CollisionRect
 
         public Rectangle CollisionRect
 
         {
 
         {
แถว 531: แถว 548:
 
                     (int)(Position.Y),
 
                     (int)(Position.Y),
 
                     (int)5,
 
                     (int)5,
                     (int)5);
+
                     (int)10);
 
             }
 
             }
 
         }
 
         }
แถว 541: แถว 558:
 
             set { velocity = value; }
 
             set { velocity = value; }
 
         }
 
         }
 +
 
         private int attackPower;
 
         private int attackPower;
 
         public int AttackPower
 
         public int AttackPower
แถว 546: แถว 564:
 
             get { return attackPower; }
 
             get { return attackPower; }
 
         }
 
         }
 +
       
 
         private float xPositionFromBarCenter;
 
         private float xPositionFromBarCenter;
 
         public float XPositionFromBarCenter
 
         public float XPositionFromBarCenter
แถว 551: แถว 570:
 
             get { return xPositionFromBarCenter; }
 
             get { return xPositionFromBarCenter; }
 
             set { xPositionFromBarCenter = value; }
 
             set { xPositionFromBarCenter = value; }
         }      
+
         }
  
 
         public Bullet()
 
         public Bullet()
 
         {
 
         {
             velocity = new Vector2(0, -0.2f);          
+
             velocity = new Vector2(0, -0.5f);
 
             animation = new TranslationAnimation(bulletAnimation);
 
             animation = new TranslationAnimation(bulletAnimation);
 
+
           
 
             attackPower = 1;
 
             attackPower = 1;
 +
           
 
         }
 
         }
  
แถว 564: แถว 584:
 
         {
 
         {
 
             Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
 
             Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
 +
        }
 +
 +
        public void CollideWithBrick(Brick brick)
 +
        {
 +
            //this.attackPower = 0;
 
         }
 
         }
  
แถว 585: แถว 610:
 
             return true;
 
             return true;
 
         }
 
         }
     }
+
     }  
 
}
 
}
 
</geshi>
 
</geshi>
 
</td>
 
</td>
 +
</tr>
 +
</table>
 +
 +
==== อีกรูปแบบหนึ่งที่คล้ายๆ กัน ====
 +
<table>
 +
<tr>
 +
<td align="center">5210450040</td>
 +
<td align="center">5210450104</td>
 +
</tr>
 +
<tr>
 
<td>
 
<td>
 
<geshi lang="csharp">
 
<geshi lang="csharp">
แถว 598: แถว 633:
 
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework.Content;
 
using Microsoft.Xna.Framework.Content;
 +
  
 
namespace BreakoutLib
 
namespace BreakoutLib
 
{
 
{
 
     public class Bullet : GameObject
 
     public class Bullet : GameObject
        {
+
    {
 
         private static Animation bulletAnimation;
 
         private static Animation bulletAnimation;
  
แถว 609: แถว 645:
 
             bulletAnimation = Animation.Load("bullet.anim", content);
 
             bulletAnimation = Animation.Load("bullet.anim", content);
 
         }
 
         }
 +
 
         private TranslationAnimation animation;
 
         private TranslationAnimation animation;
 
         public override GameLib.Animation.Animation Animation
 
         public override GameLib.Animation.Animation Animation
แถว 614: แถว 651:
 
             get { return animation; }
 
             get { return animation; }
 
         }
 
         }
 +
 
         public Vector2 Position
 
         public Vector2 Position
 
         {
 
         {
แถว 638: แถว 676:
 
             set { velocity = value; }
 
             set { velocity = value; }
 
         }
 
         }
 
 
         private int attackPower;
 
         private int attackPower;
 
         public int AttackPower
 
         public int AttackPower
แถว 644: แถว 681:
 
             get { return attackPower; }
 
             get { return attackPower; }
 
         }
 
         }
       
 
 
         private float xPositionFromBarCenter;
 
         private float xPositionFromBarCenter;
 
         public float XPositionFromBarCenter
 
         public float XPositionFromBarCenter
แถว 650: แถว 686:
 
             get { return xPositionFromBarCenter; }
 
             get { return xPositionFromBarCenter; }
 
             set { xPositionFromBarCenter = value; }
 
             set { xPositionFromBarCenter = value; }
         }
+
         }      
  
 
         public Bullet()
 
         public Bullet()
แถว 661: แถว 697:
  
 
         public void UpdatePosition(GameTime gameTime)
 
         public void UpdatePosition(GameTime gameTime)
         {      
+
         {
            Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
+
            Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
 
         }
 
         }
  
แถว 681: แถว 717:
 
             if (intersectingArea.Height > intersectingArea.Width)
 
             if (intersectingArea.Height > intersectingArea.Width)
 
                 return false;
 
                 return false;
           
+
 
 
             return true;
 
             return true;
 
         }
 
         }
     }  
+
     }
 
}
 
}
 
</geshi>
 
</geshi>
แถว 701: แถว 737:
 
{
 
{
 
     public class Bullet : GameObject
 
     public class Bullet : GameObject
    {
+
        {
 
         private static Animation bulletAnimation;
 
         private static Animation bulletAnimation;
  
แถว 708: แถว 744:
 
             bulletAnimation = Animation.Load("bullet.anim", content);
 
             bulletAnimation = Animation.Load("bullet.anim", content);
 
         }
 
         }
 
 
         private TranslationAnimation animation;
 
         private TranslationAnimation animation;
 
         public override GameLib.Animation.Animation Animation
 
         public override GameLib.Animation.Animation Animation
แถว 714: แถว 749:
 
             get { return animation; }
 
             get { return animation; }
 
         }
 
         }
 
 
         public Vector2 Position
 
         public Vector2 Position
 
         {
 
         {
แถว 720: แถว 754:
 
             get { return animation.Displacement; }
 
             get { return animation.Displacement; }
 
         }
 
         }
       
+
 
     
 
 
         public Rectangle CollisionRect
 
         public Rectangle CollisionRect
 
         {
 
         {
แถว 730: แถว 763:
 
                     (int)(Position.Y),
 
                     (int)(Position.Y),
 
                     (int)5,
 
                     (int)5,
                     (int)10);
+
                     (int)5);
 
             }
 
             }
 
         }
 
         }
แถว 756: แถว 789:
 
         public Bullet()
 
         public Bullet()
 
         {
 
         {
             velocity = new Vector2(0, -0.5f);
+
             velocity = new Vector2(0, -0.2f);          
 
             animation = new TranslationAnimation(bulletAnimation);
 
             animation = new TranslationAnimation(bulletAnimation);
           
+
 
 
             attackPower = 1;
 
             attackPower = 1;
           
 
 
         }
 
         }
  
 
         public void UpdatePosition(GameTime gameTime)
 
         public void UpdatePosition(GameTime gameTime)
         {
+
         {      
            Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
+
            Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
        }
 
 
 
        public void CollideWithBrick(Brick brick)
 
        {
 
            //this.attackPower = 0;
 
 
         }
 
         }
  
แถว 789: แถว 816:
 
             if (intersectingArea.Height > intersectingArea.Width)
 
             if (intersectingArea.Height > intersectingArea.Width)
 
                 return false;
 
                 return false;
 
+
           
 
             return true;
 
             return true;
 
         }
 
         }
แถว 796: แถว 823:
 
</geshi>
 
</geshi>
 
</td>
 
</td>
 +
</tr>
 +
</table>
 +
 +
=== Bullet.cs (Pattern 2) ===
 +
เหมือนทุกไบต์
 +
<table>
 +
<tr>
 +
<td align="center">5210400433</td>
 +
<td align="center">5210404803</td>
 +
</tr>
 +
<tr>
 
<td>
 
<td>
 
<geshi lang="csharp">
 
<geshi lang="csharp">
แถว 802: แถว 840:
 
using System.Linq;
 
using System.Linq;
 
using System.Text;
 
using System.Text;
using GameLib.Animation;
 
 
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework.Content;
 
using Microsoft.Xna.Framework.Content;
 +
using GameLib;
 +
using GameLib.Animation;
  
 
namespace BreakoutLib
 
namespace BreakoutLib
แถว 829: แถว 868:
 
         }
 
         }
  
       
+
         public int Radius
         public float Top
 
 
         {
 
         {
             set { animation.Displacement = new Vector2(animation.Displacement.X, value); }
+
             get { return (int)Constants.BALL_RADIUS; }
            get { return animation.Displacement.Y; }
 
 
         }
 
         }
         public float Bottom
+
         public int Diameter
 
         {
 
         {
            set { animation.Displacement = new Vector2(animation.Displacement.X, value); }
+
             get { return Radius * 2; }
             get { return animation.Displacement.Y; }
 
 
         }
 
         }
 
       
 
  
 
         public Rectangle CollisionRect
 
         public Rectangle CollisionRect
แถว 848: แถว 882:
 
             {
 
             {
 
                 return new Rectangle(
 
                 return new Rectangle(
                     (int)(Position.X),
+
                     (int)(Position.X - Radius),
                     (int)(Position.Y),
+
                     (int)(Position.Y - Radius),
                     (int)5,
+
                     (int)Diameter,
                     (int)5);
+
                     (int)Diameter);
 
             }
 
             }
 
         }
 
         }
  
        private Vector2 velocity;
+
 
        public Vector2 Velocity
 
        {
 
            get { return velocity; }
 
            set { velocity = value; }
 
        }
 
  
 
         private int attackPower;
 
         private int attackPower;
แถว 874: แถว 903:
 
             set { xPositionFromBarCenter = value; }
 
             set { xPositionFromBarCenter = value; }
 
         }
 
         }
 
 
  
 
         public Bullet()
 
         public Bullet()
 
         {
 
         {
            velocity = new Vector2(0.0f, -0.2f);
 
 
             animation = new TranslationAnimation(bulletAnimation);
 
             animation = new TranslationAnimation(bulletAnimation);
  
 
             attackPower = 1;
 
             attackPower = 1;
              
+
             xPositionFromBarCenter = Radius;
 +
        }
 +
 
 +
        public void UpdatePosition(GameTime gameTime)
 +
        {
 +
            Position = new Vector2(Position.X,
 +
                Position.Y - Constants.BALL_VERTICAL_SPEED * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
 +
        }
 +
    }
 +
}
 +
</geshi>
 +
</td>
 +
<td>
 +
<geshi lang="csharp">
 +
using System;
 +
using System.Collections.Generic;
 +
using System.Linq;
 +
using System.Text;
 +
using Microsoft.Xna.Framework;
 +
using Microsoft.Xna.Framework.Content;
 +
using GameLib;
 +
using GameLib.Animation;
 +
 
 +
namespace BreakoutLib
 +
{
 +
    public class Bullet : GameObject
 +
    {
 +
        private static Animation bulletAnimation;
 +
 
 +
        public static void LoadContent(ContentManager content)
 +
        {
 +
            bulletAnimation = Animation.Load("bullet.anim", content);
 +
        }
 +
 
 +
        private TranslationAnimation animation;
 +
        public override GameLib.Animation.Animation Animation
 +
        {
 +
            get { return animation; }
 
         }
 
         }
  
 +
        public Vector2 Position
 +
        {
 +
            set { animation.Displacement = value; }
 +
            get { return animation.Displacement; }
 +
        }
  
 +
        public int Radius
 +
        {
 +
            get { return (int)Constants.BALL_RADIUS; }
 +
        }
 +
        public int Diameter
 +
        {
 +
            get { return Radius * 2; }
 +
        }
  
         public void UpdatePosition(GameTime gameTime)
+
         public Rectangle CollisionRect
 
         {
 
         {
             Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
+
             get
 +
            {
 +
                return new Rectangle(
 +
                    (int)(Position.X - Radius),
 +
                    (int)(Position.Y - Radius),
 +
                    (int)Diameter,
 +
                    (int)Diameter);
 +
            }
 
         }
 
         }
  
       
 
  
         private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
+
 
 +
         private int attackPower;
 +
        public int AttackPower
 
         {
 
         {
             if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
+
             get { return attackPower; }
                return false;
+
        }
            if (intersectingArea.Height > intersectingArea.Width)
 
                return false;
 
  
             return true;
+
        private float xPositionFromBarCenter;
 +
        public float XPositionFromBarCenter
 +
        {
 +
             get { return xPositionFromBarCenter; }
 +
            set { xPositionFromBarCenter = value; }
 
         }
 
         }
  
         private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
+
         public Bullet()
 
         {
 
         {
             if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
+
             animation = new TranslationAnimation(bulletAnimation);
                return false;
+
 
             if (intersectingArea.Height > intersectingArea.Width)
+
            attackPower = 1;
                return false;
+
             xPositionFromBarCenter = Radius;
 +
        }
  
             return true;
+
        public void UpdatePosition(GameTime gameTime)
 +
        {
 +
             Position = new Vector2(Position.X,
 +
                Position.Y - Constants.BALL_VERTICAL_SPEED * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
 
         }
 
         }
 
     }
 
     }

รุ่นแก้ไขปัจจุบันเมื่อ 09:53, 21 มีนาคม 2554

คะแนน

คนที่ไม่ได้ 0 คะแนน

  • 47180278 ได้ 83 คะแนน
    • -5 for only adding one ball
    • -5 for not shooting the ball immediately
    • -5 for shooting only one bullet
    • -2 for having no music when the player clears a stage
  • 51180198 ได้ 100 คะแนน
  • 51180248 ได้ 100 คะแนน
  • 5210400425 ได้ 100 คะแนน
  • 5210400514 ได้ 93 คะแนน
    • -2 for no background music"
    • -5 for not changing the background image
  • 5210404889 ได้ 100 คะแนน
  • 5210404897 ได้ 98 คะแนน
    • -2 for not having music when player clears a stage
  • 5210405036 ได้ 98 คะแนน
    • -2 for not having music when player clears a stage
  • 5210450937 ได้ 94 คะแนน
    • -2 for no sound when bar hits wall
    • -2 for no sound when bar dies
    • -2 for not playing a song when the player clears a stage
  • 5210450562 ได้ 100 คะแนน

คนที่ได้ 0 คะแนนเนื่องจากลอกเพื่อนหรือให้เพื่อนลอก

  • 51180537
  • 51180628
  • 51180727
  • 51180644
  • 5210400433
  • 5210404803
  • 5210450040
  • 5210450058
  • 5210450104
  • 5210450147
  • 5210450597

การลอกกันที่ผมจับได้

โค้ดเปลี่ยนด่านใน PlayScreen.cs

51180537 51180628 51180727

<geshi lang="csharp">

               else if (playScreen.gameState.BrickCount <= 0)
               {
                 
                   
                   if (lv == 3)
                   {
                       Constants.MAP_NAME = "map03";


                   }
                   else
                   {
                       Constants.MAP_NAME = "map02";
                       lv = 3;
                   }
                   playScreen.LoadContent();
                   if (lv2 != 3)
                   {
                       lv2 += 1;
                       MediaPlayer.Stop();
                       MediaPlayer.Play(song3);
                       playScreen.Game.SwitchScreen(Constants.NEXT_LV_SCREEN_NAME);
          
                   }
                   else
                   {
                       lv = 1;
                       lv2 = 1;
                       Constants.MAP_NAME = "map01.txt";
                       playScreen.LoadContent();
                       playScreen.Game.SwitchScreen(Constants.GAME_CLEARED_SCREEN_NAME);
                   }
               }
               else if (playScreen.keySensor.IsKeyTyped(KeyMapping.pauseKey))
                   playScreen.ChangeState(playScreen.pauseState);
           }

</geshi>

<geshi lang="csharp">

               else if (playScreen.gameState.BrickCount <= 0)
               {
                   if (lv == 3)
                   {
                       Constants.MAP_NAME = "map03";
                       MediaPlayer.Stop();
                   }
                   else
                   {
                       Constants.MAP_NAME = "map02";
                       MediaPlayer.Stop();
                       lv = 3;
                   }
                   playScreen.LoadContent();
                   if (lv2 != 3)
                   {
                       lv2 += 1;
                       MediaPlayer.Play(song4);
                       playScreen.Game.SwitchScreen(Constants.NEXT_LV_SCREEN_NAME);
                   }
                   else
                   {
                       lv = 1;
                       lv2 = 1;
                       Constants.MAP_NAME = "map01";
                       MediaPlayer.Play(song5);
                       Constants.ascore = 0;
                       playScreen.LoadContent();
                       playScreen.Game.SwitchScreen(Constants.GAME_CLEARED_SCREEN_NAME);
                   }
               }
               else if (playScreen.keySensor.IsKeyTyped(KeyMapping.pauseKey))
                   playScreen.ChangeState(playScreen.pauseState);
           }

</geshi>

<geshi lang="csharp">

               else if (playScreen.gameState.BrickCount <= 0)
               {
                   if (lv == 3)
                   {
                       Constants.MAP_NAME = "map03";


                   }
                   else
                   {
                       Constants.MAP_NAME = "map02";
                       lv = 3;
                   }
                   playScreen.LoadContent();
                   if (lv2 != 3)
                   {
                       lv2 += 1;
                       playScreen.Game.SwitchScreen(Constants.NEXT_LV_SCREEN_NAME);
                   }
                   else
                   {
                       lv = 1;
                       lv2 = 1;
                       Constants.MAP_NAME = "map01.txt";
                       playScreen.Game.SwitchScreen(Constants.GAME_CLEARED_SCREEN_NAME);
                   }
               }
               else if (playScreen.keySensor.IsKeyTyped(KeyMapping.pauseKey))
                   playScreen.ChangeState(playScreen.pauseState);

</geshi>

  • 51180537 และ 51180644

Breakout-playscreen-51180537-51180644.JPG

Bullet.cs (Pattern 1)

นิสิตหลายคนทำการคัดลอก Ball.cs มาเป็น Bullet.cs (47180278, 51180248, 5210404889, 5210404897, 5210400425, และ 5210405036) นี่ไม่นับเป็นการลอกเนื่องจากเป็นการใช้โค้ดเก่าของอาจารย์ อย่างไรก็ดีโค้ดของนิสิต 7 คนข้างล่างนี้มีลักษณะเด่นเหมือนๆ กัน ดังต่อไปนี้ คือ

  • เหลือเมธอด CollideOnTopSurface และ ColildeOnButtomSurface ไว้ ไม่คง CollideOnLeftSurface และ CollideOnRightSurface ของ Ball.cs เดิมไว้
  • กำหนดให้ Bullet มีขนาด 5 x 5 ช่องเหมือนๆ กัน

นอกจากนี้ไฟล์ของนิสิตบางคู่ัยังเหมือนกันทุกไบต์ จึงสันนิษฐานเอาไว้ว่าลอกกัน

5210450058 5210450147 5210450597

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using GameLib.Animation; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content;

namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       private Vector2 velocity;
       public Vector2 Velocity
       {
           get { return velocity; }
           set { velocity = value; }
       }
       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           velocity = new Vector2(0.0f, -0.2f);            
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
       }


       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X),
                   (int)(Position.Y),
                   (int)5,
                   (int)5);
           }
       }


       private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
       public void CollideWithBrick(Brick brick)
       {
       }
       private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
   }    

} </geshi>

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using GameLib.Animation; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content;

namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       private Vector2 velocity;
       public Vector2 Velocity
       {
           get { return velocity; }
           set { velocity = value; }
       }
       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           velocity = new Vector2(0.0f, -0.2f);            
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
       }


       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X),
                   (int)(Position.Y),
                   (int)5,
                   (int)5);
           }
       }


       private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
       public void CollideWithBrick(Brick brick)
       {
       }
       private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
   }    

} </geshi>

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using GameLib.Animation; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content;

namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       private Vector2 velocity;
       public Vector2 Velocity
       {
           get { return velocity; }
           set { velocity = value; }
       }
       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           velocity = new Vector2(0.0f, -0.2f);            
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
       }


       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X),
                   (int)(Position.Y),
                   (int)5,
                   (int)5);
           }
       }


       private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
       public void CollideWithBrick(Brick brick)
       {
       }
       private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
   }    

} </geshi>

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using GameLib.Animation; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content;

namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       
      
       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X),
                   (int)(Position.Y),
                   (int)5,
                   (int)10);
           }
       }
       private Vector2 velocity;
       public Vector2 Velocity
       {
           get { return velocity; }
           set { velocity = value; }
       }
       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           velocity = new Vector2(0, -0.5f);
           animation = new TranslationAnimation(bulletAnimation);
           
           attackPower = 1;
           
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
       }
       public void CollideWithBrick(Brick brick)
       {
           //this.attackPower = 0;
       }
       private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
       private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
   }    

} </geshi>

อีกรูปแบบหนึ่งที่คล้ายๆ กัน

5210450040 5210450104

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using GameLib.Animation; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content;


namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X),
                   (int)(Position.Y),
                   (int)5,
                   (int)5);
           }
       }
       private Vector2 velocity;
       public Vector2 Velocity
       {
           get { return velocity; }
           set { velocity = value; }
       }
       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }       
       public Bullet()
       {
           velocity = new Vector2(0, -0.2f);            
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
       }
       private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
       private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
   }

} </geshi>

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using GameLib.Animation; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content;

namespace BreakoutLib {

   public class Bullet : GameObject
       {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X),
                   (int)(Position.Y),
                   (int)5,
                   (int)5);
           }
       }
       private Vector2 velocity;
       public Vector2 Velocity
       {
           get { return velocity; }
           set { velocity = value; }
       }
       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           velocity = new Vector2(0, -0.2f);            
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
       }
       public void UpdatePosition(GameTime gameTime)
       {        
            Position = Position + velocity * (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
       }
       private bool CollidedOnTopSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y > brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
           return true;
       }
       private bool CollidedOnBottomSurface(Brick brick, Rectangle intersectingArea)
       {
           if (intersectingArea.Center.Y < brick.CollisionRect.Center.Y)
               return false;
           if (intersectingArea.Height > intersectingArea.Width)
               return false;
            
           return true;
       }
   }    

} </geshi>

Bullet.cs (Pattern 2)

เหมือนทุกไบต์

5210400433 5210404803

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using GameLib; using GameLib.Animation;

namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       public int Radius
       {
           get { return (int)Constants.BALL_RADIUS; }
       }
       public int Diameter
       {
           get { return Radius * 2; }
       }
       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X - Radius),
                   (int)(Position.Y - Radius),
                   (int)Diameter,
                   (int)Diameter);
           }
       }


       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
           xPositionFromBarCenter = Radius;
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = new Vector2(Position.X,
               Position.Y - Constants.BALL_VERTICAL_SPEED * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
       }
   }

} </geshi>

<geshi lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using GameLib; using GameLib.Animation;

namespace BreakoutLib {

   public class Bullet : GameObject
   {
       private static Animation bulletAnimation;
       public static void LoadContent(ContentManager content)
       {
           bulletAnimation = Animation.Load("bullet.anim", content);
       }
       private TranslationAnimation animation;
       public override GameLib.Animation.Animation Animation
       {
           get { return animation; }
       }
       public Vector2 Position
       {
           set { animation.Displacement = value; }
           get { return animation.Displacement; }
       }
       public int Radius
       {
           get { return (int)Constants.BALL_RADIUS; }
       }
       public int Diameter
       {
           get { return Radius * 2; }
       }
       public Rectangle CollisionRect
       {
           get
           {
               return new Rectangle(
                   (int)(Position.X - Radius),
                   (int)(Position.Y - Radius),
                   (int)Diameter,
                   (int)Diameter);
           }
       }


       private int attackPower;
       public int AttackPower
       {
           get { return attackPower; }
       }
       private float xPositionFromBarCenter;
       public float XPositionFromBarCenter
       {
           get { return xPositionFromBarCenter; }
           set { xPositionFromBarCenter = value; }
       }
       public Bullet()
       {
           animation = new TranslationAnimation(bulletAnimation);
           attackPower = 1;
           xPositionFromBarCenter = Radius;
       }
       public void UpdatePosition(GameTime gameTime)
       {
           Position = new Vector2(Position.X,
               Position.Y - Constants.BALL_VERTICAL_SPEED * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
       }
   }

} </geshi>