コード例 #1
0
ファイル: Game1.cs プロジェクト: alexdbaldwin/ab4645-Breakout
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
#if (!ARCADE)
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
#endif

            //Textures
            AssetManager.AddTexture("pixel", Content.Load<Texture2D>("pixel"));
            AssetManager.AddTexture("paddles", Content.Load<Texture2D>("paddles"));
            AssetManager.AddTexture("block", Content.Load<Texture2D>("block"));
            //AssetManager.AddTexture("ball", Content.Load<Texture2D>("ball_spritesheet"));
            AssetManager.AddTexture("balls", Content.Load<Texture2D>("balls"));
            AssetManager.AddTexture("softparticle", Content.Load<Texture2D>("softparticle"));
            AssetManager.AddTexture("powerup", Content.Load<Texture2D>("powerup"));
            AssetManager.AddTexture("level1bg", Content.Load<Texture2D>("level1bg"));
            AssetManager.AddTexture("heart", Content.Load<Texture2D>("heart"));
            AssetManager.AddTexture("heart_blue", Content.Load<Texture2D>("heart_blue"));
            AssetManager.AddTexture("gun", Content.Load<Texture2D>("gun"));

            //Fonts
            AssetManager.AddFont("main", Content.Load<SpriteFont>("MainFont"));

            //Sound effects
            AssetManager.AddSound("bounce", Content.Load<SoundEffect>("bounce"));
            AssetManager.AddSound("death", Content.Load<SoundEffect>("death"));
            AssetManager.AddSound("powerup", Content.Load<SoundEffect>("powerup_get"));

            //Music
           
            gm = new GameplayManager(Content.RootDirectory);

            
            
        }
コード例 #2
0
        public Paddle(PlayerIndex playerIndex, GameplayManager gm, Vector2 position, float width, float height, float maxTranslation, World world) : base(world) {
            this.playerIndex = playerIndex;
            this.gm = gm;
            this.width = width;
            this.height = height;
            this.maxTranslation = maxTranslation;
            startPos = new Vector2(position.X,position.Y) ;

            body = BodyFactory.CreateRectangle(world, width, height, 1, position);
            body.BodyType = BodyType.Dynamic;
            body.CollidesWith = Category.Cat1 | Category.Cat3;
            body.CollisionCategories = Category.Cat2;
            body.Restitution = 1.0f;
            body.Friction = 0.0f;
            body.UserData = this;

            ground = BodyFactory.CreateRectangle(world, 1, 1, 1);


            joint = JointFactory.CreatePrismaticJoint(world, ground, body, position, new Vector2(1, 0),true);
            joint.LowerLimit = -maxTranslation + width / 2.0f;
            joint.UpperLimit = maxTranslation - width / 2.0f;
            joint.LimitEnabled = true;
            body.LinearDamping = 7.0f;

        }
コード例 #3
0
        public PowerUp(GameplayManager gm, World world, Vector2 position, PowerUpType type) : base(world)
        {
            this.gm = gm;
            this.type = type;

            body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(40), ConvertUnits.ToSimUnits(40), 1, position);
            body.BodyType = BodyType.Dynamic;
            body.CollidesWith = Category.Cat2;
            body.CollisionCategories = Category.Cat3;
            body.OnCollision += OnCollision;
            body.UserData = this;

            body.ApplyLinearImpulse(new Vector2(0, 1.0f));
        }
コード例 #4
0
 public Player(GameplayManager gm, Paddle paddle, PlayerIndex playerIndex) {
     this.gm = gm;
     this.paddle = paddle;
     this.playerIndex = playerIndex;
 }
コード例 #5
0
 public Player(GameplayManager gm, Paddle paddle, PlayerIndex playerIndex)
 {
     this.gm          = gm;
     this.paddle      = paddle;
     this.playerIndex = playerIndex;
 }