Esempio n. 1
0
        /// <summary>
        /// create a ball Spritelet that can be scaled
        /// </summary>
        /// <param name="radius">the relative size scaling, 1 is normal</param>
        /// <returns></returns>
        public Entity CreateBall(double radius)
        {
            Entity e = TTFactory.CreateSpritelet(this.BallSprite);

            e.AddComponent(new ScaleComp(radius));
            return(e);
        }
Esempio n. 2
0
        /// <summary>
        /// create a ball Spritelet that can be scaled
        /// </summary>
        /// <param name="radius">the relative size scaling, 1 is normal</param>
        /// <returns></returns>
        public Entity CreateBall(double radius)
        {
            Entity e = TTFactory.CreateSpritelet("paul-hardman_circle-four");

            e.AddComponent(new ScaleComp(radius));
            return(e);
        }
Esempio n. 3
0
        public static Entity CreateSubtitle(SubtitleText stComp)
        {
            var e = TTFactory.CreateDrawlet();

            e.AddComponent(stComp);
            e.Refresh();
            return(e);
        }
Esempio n. 4
0
        protected override void LoadContent()
        {
            // level
            Level = new Level1();
            Level.Init();
            TTFactory.CreateScriptlet(Level);

            base.LoadContent();
        }
Esempio n. 5
0
        public Entity CreateMovingTextlet(Vector2 pos, string text)
        {
            var t = TTFactory.CreateTextlet(text);

            t.GetComponent <PositionComp>().Position2D = pos;
            t.GetComponent <DrawComp>().DrawColor      = Color.Black;
            t.GetComponent <VelocityComp>().Velocity   = 0.2f * new Vector3((float)rnd.NextDouble() - 0.5f, (float)rnd.NextDouble() - 0.5f, 0f);
            t.GetComponent <ScaleComp>().Scale         = 0.5;
            return(t);
        }
Esempio n. 6
0
        public Entity CreateTextlet(Vector2 pos, string text, Color col)
        {
            var txt = TTFactory.CreateTextlet(text);

            txt.GetComponent <PositionComp>().Position2D = pos;
            txt.GetComponent <PositionComp>().Z          = 0f + 0.1f * ((float)rnd.NextDouble()); // random Z position
            txt.GetComponent <DrawComp>().DrawColor      = col;
            txt.GetComponent <ScaleComp>().Scale         = 0.8;
            return(txt);
        }
Esempio n. 7
0
        public static Entity CreateLevelet(Level lev)
        {
            var e = TTFactory.CreateDrawlet();

            e.AddComponent(new ScaleComp());
            e.AddComponent(new ThingComp(ThingType.OTHER, null, lev.Background.Texture));
            e.AddComponent(new ScriptComp());
            e.AddComponent(lev.Background);
            e.Refresh();
            return(e);
        }
Esempio n. 8
0
        /// <summary>
        /// Creates a new FrameRateCounter. TODO: screen position set.
        /// </summary>
        /// <returns></returns>
        public static Entity Create(Color textColor)
        {
            var e = TTFactory.CreateTextlet("##");

            e.GetComponent <PositionComp>().Position = new Vector3(0.03f, 0.01f, 0f);
            e.GetComponent <DrawComp>().DrawColor    = textColor;
            var m = new ScriptComp(new FrameRateCounter(e.GetComponent <TextComp>()));

            e.AddComponent(m);
            e.Refresh();
            return(e);
        }
Esempio n. 9
0
        public static Entity CreateThing(ThingType tp, bool hasControls, string bitmap)
        {
            var e  = TTFactory.CreateSpritelet(bitmap);
            var sc = e.GetComponent <SpriteComp>();
            var tc = new ThingComp(tp, Level.Current.Background, sc.Texture);

            e.AddComponent(tc);
            if (hasControls)
            {
                var tcc = new ThingControlComp();
                e.AddComponent(tcc);
            }
            tc.PassableIntensityThreshold = Level.Current.DefaultPassableIntensityThreshold;
            var textureData = new Color[tc.BoundingRectangle.Width * tc.BoundingRectangle.Height];

            sc.Texture.GetData(textureData);
            sc.Center = Vector3.Zero;

            return(e);
        }