Exemple #1
0
        protected Vector2 GenerateRandomXY(bool isTop = false)
        {
            Random r = new Random();

            if (isTop)
            {
                return(new Vector2(r.Next(GameData.ScreenWidth), 0));
            }
            else
            {
                return(new Vector2(r.Next(GameData.ScreenWidth), GameData.ScreenHeight - ScreenCalculator.PercentageH(0.098f)));
            }
        }
        public AlliedMissile(Vector2 target)
        {
            position        = new Vector2(GameData.ScreenWidth / 2, GameData.ScreenHeight - ScreenCalculator.PercentageH(0.1f));
            this.target     = target;
            targetXDistance = (position.X - target.X);
            targetYDistance = (position.Y - target.Y);
            GetFrames(GameData.ImageData.AlliedMissileFrames);

            CalculateTrajectory();
            CalculateRotation();

            numberOfFrames = frames.Count() - 1;
            frameTime      = 0.2f;
            time           = Raylib.GetTime();
        }