Inheritance: GameObject
Exemplo n.º 1
0
 public void Fire(Ball ball)
 {
     ball.Position = this.Position;
     ball.Velocity = this.Direction*10;
     ball.Enabled = true;
     hasShot = true;
 }
Exemplo n.º 2
0
 public override void Reset()
 {
     niceCannon = new Cannon(Content.Load<Texture2D>("Images/kanon"), new Vector2(240, 784), new Vector2(0, -1));
     badCannon = new Cannon(Content.Load<Texture2D>("Images/slemKanon"), new Vector2(240, 16), new Vector2(0, 1));
     niceBall = new Ball(Content.Load<Texture2D>("Images/ball"));
     badBall = new Ball(Content.Load<Texture2D>("Images/slemBall"));
     score = 0;
 }
Exemplo n.º 3
0
        public GameLevel(SpriteBatch spriteBatch, ContentManager content, int gameStateIndex)
            : base(spriteBatch, content, gameStateIndex)
        {
            Instance = this;

            // TODO: use Content to load your game content here

            score = 0;

            fireButtonTexture = Content.Load<Texture2D>(@"Images\fireButton");
            font = Content.Load<SpriteFont>("Font");

            win = Content.Load<SoundEffect>("Sound/Cannon_Game_Win");
            lose = Content.Load<SoundEffect>("Sound/Cannon_Game_Lose");

            niceCannon = new Cannon(Content.Load<Texture2D>("Images/kanon"), new Vector2(240, 784), new Vector2(0, -1));
            badCannon = new Cannon(Content.Load<Texture2D>("Images/slemKanon"), new Vector2(240, 16), new Vector2(0, 1));
            niceBall = new Ball(Content.Load<Texture2D>("Images/ball"));
            badBall = new Ball(Content.Load<Texture2D>("Images/slemBall"));
            target = new Target(Content.Load<Texture2D>("Images/mål"));
            shoot = new Rectangle(480 - 48, 450, 48, 48);

            Objects = new List<GameObject>();
        }