public GameScreen(ContentManager Content, Texture2D Background, Player player, Robot robot, bool OnLeftSide)
        {
            this.Content.Unload();
            this.Content.Dispose();
            this.Content = Content;

            //Do some stuff to Left and Right before adding them
            if (OnLeftSide)
            {
                player.Position = new Vector2(60, 120);
                robot.Position = new Vector2(730, 120);
            }
            else
            {
                player.Position = new Vector2(730, 120);
                robot.Position = new Vector2(60, 120);
            }

            FlyingDisc flyingDisc = new FlyingDisc(Content.Load<Texture2D>("General\\FlyingDisc"));
            flyingDisc.Position = new Vector2(70, 110);

            Entities = new List<Entity>(new List<Entity> { player, robot, flyingDisc });

            this.Background = Background;
        }
示例#2
0
        public GameScreen(ContentManager Content, Texture2D Background, Player player, Robot robot, bool OnLeftSide)
        {
            this.Content.Unload();
            this.Content.Dispose();
            this.Content = Content;

            //Do some stuff to Left and Right before adding them
            if (OnLeftSide)
            {
                player.Position = new Vector2(60, 120);
                robot.Position  = new Vector2(730, 120);
            }
            else
            {
                player.Position = new Vector2(730, 120);
                robot.Position  = new Vector2(60, 120);
            }


            FlyingDisc flyingDisc = new FlyingDisc(Content.Load <Texture2D>("General\\FlyingDisc"));

            flyingDisc.Position = new Vector2(70, 110);

            Entities = new List <Entity>(new List <Entity> {
                player, robot, flyingDisc
            });

            this.Background = Background;
        }
        public override void Update(GameTime Time, FlyingDisc FlyingDisc)
        {
            base.Update(Time, FlyingDisc);

            HandPosition = Position + new Vector2(45, 55);
            if (Vector2.Distance(HandPosition, FlyingDisc.Position) < 100)
            {
                if (!FlyingDiscExiting) HasFlyingDisc = true;
            }
            else FlyingDiscExiting = false;

            foreach (TouchLocation Touch in Input.Touches)
            {
                if (Touch.State == TouchLocationState.Moved || Touch.State == TouchLocationState.Pressed)
                {
                    if (Touch.Position.X < Graphics.Width / 2)
                    {
                        this.Force = base.Grounded ? new Vector2(-50, 0) : new Vector2(-25, 0);
                        base.Direction = SpriteEffects.FlipHorizontally;
                    }
                    else
                    {
                        this.Force = base.Grounded ? new Vector2(50, 0) : new Vector2(25, 0);
                        base.Direction = SpriteEffects.None;
                    }
                }
            }

            if (HasFlyingDisc)
            {
                while(TouchPanel.IsGestureAvailable)
                {
                    GestureSample sample = TouchPanel.ReadGesture();

                    if (sample.GestureType == GestureType.Flick)
                    {
                        if (sample.Delta.Length() > 3)
                        {
                            double Rotation = Math.Atan2(sample.Delta.Y, sample.Delta.X);

                            if (Rotation > 0 && Rotation < MathHelper.PiOver2)
                            {
                                ///fixxxxxxx
                                Throw(FlyingDisc, sample);
                            }
                        }
                    }
                }
            }

            if (HasFlyingDisc) FlyingDisc.Position = HandPosition - FlyingDisc.Origin;
        }
示例#4
0
        public virtual void Update(GameTime Time, FlyingDisc FlyingDisc)
        {
            Velocity += (Force / Mass) + (new Vector2(0, Constants.Gravity)) / 2 * (float)Time.ElapsedGameTime.TotalSeconds;
            Position += Velocity * (float)Time.ElapsedGameTime.TotalSeconds;

            Direction = Velocity.X < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;

            Force = Vector2.Zero;

            if (this.Position.Y + Texture.Height > Graphics.Height)
            {
                Position = new Vector2(Position.X, Graphics.Height - Texture.Height);
                Grounded = true;
            }
            else
            {
                Grounded = false;
            }
        }
        public virtual void Update(GameTime Time, FlyingDisc FlyingDisc)
        {
            Velocity += (Force / Mass) + (new Vector2(0, Constants.Gravity)) / 2 * (float)Time.ElapsedGameTime.TotalSeconds;
            Position += Velocity * (float)Time.ElapsedGameTime.TotalSeconds;

            Direction = Velocity.X < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;

            Force = Vector2.Zero;

            if (this.Position.Y + Texture.Height > Graphics.Height)
            {
                Position = new Vector2(Position.X, Graphics.Height - Texture.Height);
                Grounded = true;
            }
            else
            {
                Grounded = false;
            }
        }
示例#6
0
 private void Throw(FlyingDisc FlyingDisc, GestureSample sample)
 {
     FlyingDisc.Force  = sample.Delta / 10;
     HasFlyingDisc     = false;
     FlyingDiscExiting = true;
 }
示例#7
0
        public override void Update(GameTime Time, FlyingDisc FlyingDisc)
        {
            base.Update(Time, FlyingDisc);

            HandPosition = Position + new Vector2(45, 55);
            if (Vector2.Distance(HandPosition, FlyingDisc.Position) < 100)
            {
                if (!FlyingDiscExiting)
                {
                    HasFlyingDisc = true;
                }
            }
            else
            {
                FlyingDiscExiting = false;
            }

            foreach (TouchLocation Touch in Input.Touches)
            {
                if (Touch.State == TouchLocationState.Moved || Touch.State == TouchLocationState.Pressed)
                {
                    if (Touch.Position.X < Graphics.Width / 2)
                    {
                        this.Force     = base.Grounded ? new Vector2(-50, 0) : new Vector2(-25, 0);
                        base.Direction = SpriteEffects.FlipHorizontally;
                    }
                    else
                    {
                        this.Force     = base.Grounded ? new Vector2(50, 0) : new Vector2(25, 0);
                        base.Direction = SpriteEffects.None;
                    }
                }
            }

            if (HasFlyingDisc)
            {
                while (TouchPanel.IsGestureAvailable)
                {
                    GestureSample sample = TouchPanel.ReadGesture();

                    if (sample.GestureType == GestureType.Flick)
                    {
                        if (sample.Delta.Length() > 3)
                        {
                            double Rotation = Math.Atan2(sample.Delta.Y, sample.Delta.X);


                            if (Rotation > 0 && Rotation < MathHelper.PiOver2)
                            {
                                ///fixxxxxxx
                                Throw(FlyingDisc, sample);
                            }
                        }
                    }
                }
            }


            if (HasFlyingDisc)
            {
                FlyingDisc.Position = HandPosition - FlyingDisc.Origin;
            }
        }
        public override void Update(GameTime Time, FlyingDisc FlyingDisc)
        {
            base.Update(Time,FlyingDisc);

            //if (HasFlyingDisc) FlyingDisc.Position = base.HandPosition - FlyingDisc.Origin;
        }
 public override void Update(GameTime Time, FlyingDisc FlyingDisc)
 {
     base.Update(Time, FlyingDisc);
 }
示例#10
0
        public override void Update(GameTime Time, FlyingDisc FlyingDisc)
        {
            base.Update(Time, FlyingDisc);

            //if (HasFlyingDisc) FlyingDisc.Position = base.HandPosition - FlyingDisc.Origin;
        }
 private void Throw(FlyingDisc FlyingDisc, GestureSample sample)
 {
     FlyingDisc.Force = sample.Delta / 10;
     HasFlyingDisc = false;
     FlyingDiscExiting = true;
 }
 public override void Update(GameTime Time, FlyingDisc FlyingDisc)
 {
     base.Update(Time, FlyingDisc);
 }