Exemplo n.º 1
0
        public void ProcessEntity()
        {
            foreach (Entity e in compatableEntitys)
            {
                Position = e.GetComponent <TransformC>();
                keys     = Input.keys;

                Vector2 velocity = new Vector2();
                if (keys.Contains(Keys.D))
                {
                    velocity.X += 1f;
                }
                if (keys.Contains(Keys.A))
                {
                    velocity.X -= 1f;
                }
                if (keys.Contains(Keys.W) && Position.body.LinearVelocity.Y == 0)
                {
                    velocity.Y -= 20f;
                }
                if (keys.Contains(Keys.S))
                {
                    velocity.Y += 1f;
                }

                Position.addForce(velocity);
            }

            //Console.WriteLine(Position.position.ToString());
            //DRAG
            //PROBABLY SHOULD SPLIT THIS INTO ITS OWN SYSTEM
        }
Exemplo n.º 2
0
 public void ProcessEntity()
 {
     foreach (Entity e in compatableEntitys)
     {
         TextureC   Texture = e.GetComponent <TextureC>();
         TransformC Pos     = e.GetComponent <TransformC>();
         if (e.Active)
         {
             spriteBatch.Draw(Texture, new Rectangle((int)Pos.Position.X, (int)Pos.Position.Y, (int)(Texture.Texture.Width * Pos.Scale.X), (int)(Texture.Texture.Height * Pos.Scale.Y)), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0f);
         }
     }
 }
Exemplo n.º 3
0
        public void ProcessEntity()
        {
            foreach (Entity e in compatableEntitys)
            {
                TextureC  = e.GetComponent <TextureC>();
                Texture   = TextureC.Texture;
                Transform = e.GetComponent <TransformC>();

                float width  = Texture.Width * Transform.Scale.X;
                float height = Texture.Height * Transform.Scale.Y;
                spriteBatch.Draw(Texture, new Rectangle((int)Transform.Position.X, (int)Transform.Position.Y, (int)width, (int)height), Color.White);
            }
        }
        public void ProcessEntity()
        {
            //Console.WriteLine(compatableEntitys.Count);
            foreach (Entity e in compatableEntitys)
            {
                TextureC    Texture    = e.GetComponent <TextureC>();
                TransformC  Transform  = e.GetComponent <TransformC>();
                BackGroundC backGround = e.GetComponent <BackGroundC>();

                Vector2 Position = new Vector2(Transform.Position.X + (camera.matrix.Translation.X * backGround.moveRatio), Transform.Position.Y);

                float width  = Texture.Texture.Width * Transform.Scale.X;
                float height = Texture.Texture.Height * Transform.Scale.Y;
                if (graphicsDevice.Viewport.Bounds.Contains(Transform.Position.X + (camera.matrix.Translation.X * -backGround.moveRatio) + width + 50, 0) && !backGround.leftNeighbour)
                {
                    entityController.CreateEntityDelayed(Texture, new TransformC(new Vector2(Transform.Position.X + width, Transform.Position.Y), new Vector2(3, 3)), new BackGroundC(backGround.moveRatio));
                    backGround.leftNeighbour = true;
                }
                spriteBatch.Draw(Texture.Texture, new Rectangle((int)Position.X, (int)Position.Y, (int)width, (int)height), Color.White);
            }
        }