예제 #1
0
파일: Mouse.cs 프로젝트: WasimN/ShipHunter
        public void Update(InputObject ship, Viewport viewPort, GameTime time, Camera camera)
        {
            RegisterHitBox();
            mouse = Mouse.GetState();

            Position = new Vector2(mouse.X + ship.Position.X - (viewPort.Width / 2),
                mouse.Y + ship.Position.Y - (viewPort.Height / 2 ));

            Rotation += time.ElapsedGameTime.Milliseconds / 110f;
            AnimateSprite(time, 0);
        }
예제 #2
0
파일: Game1.cs 프로젝트: WasimN/ShipHunter
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: Add your initialization logic here
            mouse = new GameMouse(Content, "Art/mice", new Vector2(3,1));
            camera = new Camera();
            debug = new Debug(Content, spriteBatch, 0, 0);
            ship = new InputObject(Content, "Art/spaceShip", new Vector2(0, 0), new Vector2(0, 0), 6.0f, 30);
            backGround = new Background(Content, graphics, "Art/space");
            asteroid = new List<Asteroid>();

            blasters = new List<Blasters>();

            base.Initialize();
        }