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

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
แถว 482: แถว 482:
 
<td align="center">5210450104</td>
 
<td align="center">5210450104</td>
 
<td align="center">5210450562</td>
 
<td align="center">5210450562</td>
 +
<td align="center">5210450937</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
แถว 788: แถว 789:
 
         }
 
         }
 
     }     
 
     }     
 +
}
 +
</geshi>
 +
</td>
 +
<td>
 +
<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 float Top
 +
        {
 +
            set { animation.Displacement = new Vector2(animation.Displacement.X, value); }
 +
            get { return animation.Displacement.Y; }
 +
        }
 +
        public float Bottom
 +
        {
 +
            set { animation.Displacement = new Vector2(animation.Displacement.X, value); }
 +
            get { return animation.Displacement.Y; }
 +
        }
 +
 +
       
 +
 +
        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.0f, -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>

รุ่นแก้ไขเมื่อ 11:16, 20 มีนาคม 2554

คะแนน

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

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

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

โค้ดเปลี่ยนด่านใน 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

โค้ด LoadContent ใน PlayScreen.cs

  • 5210400433 กับ 5210404803

Breakout-playscreen-5210400433-5210404803.JPG

Bullet.cs

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>

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

5210450040 5210450104 5210450562 5210450937

<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>

<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>

<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 float Top
       {
           set { animation.Displacement = new Vector2(animation.Displacement.X, value); }
           get { return animation.Displacement.Y; }
       }
       public float Bottom
       {
           set { animation.Displacement = new Vector2(animation.Displacement.X, value); }
           get { return animation.Displacement.Y; }
       }


       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.0f, -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>