Exemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            for (int j = 0; j < GameObject.gameObjects.Count; j++)
                if (GameObject.gameObjects[j].GetType() == typeof(Player))
                    o = GameObject.gameObjects[j];
            float f = 1f;
            elapsedTime += gameTime.ElapsedGameTime.Milliseconds;
            rotation = 0;
            center = new Vector2(o.getPos().X + o.getWidth() / 2 - (Activity1.game.Window.ClientBounds.Width / 2), o.getPos().Y + o.getHeight() / 2 - (Activity1.game.Window.ClientBounds.Height / 2));
            transform = Matrix.CreateTranslation(new Vector3(-o.getPos().X, -o.getPos().Y, 0)) * Matrix.CreateScale(f, f, f) * Matrix.CreateRotationZ(-rotation) *
                Matrix.CreateTranslation(new Vector3(Activity1.game.Window.ClientBounds.Width / 2, Activity1.game.Window.ClientBounds.Height / 2, 0));
            if (elapsedTime > 1000)
            {
                timeFlag = false;
            }

            timeFlag = true;
            elapsedTime = 0;
        }
Exemplo n.º 2
0
 //deprecated (hopefully)
 public bool CheckCollision(GameObject A, GameObject B)
 {
     return A.getRect().Intersects(B.getRect());
 }
Exemplo n.º 3
0
 public void parent(GameObject o)
 {
     setPos(o.getPos());
        setRotation(o.getRotation());
 }
Exemplo n.º 4
0
 public Camera(Viewport viewport, GameObject o)
 {
     this.viewport = viewport;
     this.o = o;
     elapsedTime = 0;
 }