Пример #1
0
        public Demo3Scene()
            : base("", "")
        {
            GameEntity milkshakeLogo = new GameEntity()
            {
                Position = Globals.ScreenCenter
            };

            milkshakeLogo.AddNode(new Sprite("Scenes//Global//MilkShakeLight")
            {
                Origin = new Vector2(270, 290)
            });

            milkshakeLogo.AddNode(new Sprite("Scenes//Global//MilkShakeLogo")
            {
                AutoCenter = true
            });

            AddNode(milkshakeLogo);

            AddNode(new Sprite("Scenes//Global//Gunter")
            {
                Position = new Vector2(1000, 550)
            });
        }
Пример #2
0
        public ScriptNode(GameEntity gameEntity, string url)
        {
            mUrl = url;
            mScript = new Lua();

            AddFunctions(typeof(ScriptFunctions));
            AddFunctions(typeof(MilkHooks));

            mScript["gameObject"] = gameEntity;
            mScript["scene"] = Scene;
            attatchListeners(gameEntity);

            mScript.DoFile("Scripts//" + mUrl);
        }
Пример #3
0
        public NodeTest()
            : base("", "")
        {
            car = new DisplayObject();
            car.Position = new Vector2(100, 100);

            car.AddNode(wheel1 = new Sprite("Scenes//Demo1//wheel") { Position = new Vector2(16 + 24, 50 + 20), AutoCenter = true });
            car.AddNode(wheel2 = new Sprite("Scenes//Demo1//wheel") { Position = new Vector2(230 + 24, 50 + 20), AutoCenter = true });
            car.AddNode(window = new Sprite("Scenes//Demo1//window") { Position = new Vector2(125, 5) });
            car.AddNode(new Sprite("Scenes//Demo1//body") { AutoCenter = false });

            AddNode(container = new GameEntity());
            container.AddNode(car);

            new SceneView(this).Show();
        }
Пример #4
0
 private void attatchListeners(GameEntity gameEntity)
 {
     gameEntity.Listener.Setup   += () => dispatchEvent(EVENT_SETUP);
     gameEntity.Listener.Load    += () => dispatchEvent(EVENT_LOAD);
     gameEntity.Listener.Fixup   += () => dispatchEvent(EVENT_FIXUP);
     gameEntity.Listener.Update  += (GameTime gametime) => MilkHooks.TriggerEvent(EVENT_UPDATE, gametime);
 }
Пример #5
0
        public Demo_BreakOut()
            : base("", "")
        {
            MilkShake.Game.IsMouseVisible = true;

            AddNode(Bricks = new GameEntity());

            Texture2D redBrick = TextureUtils.GenerateTexureWithBorder(BRICK_WIDTH, BRICK_HEIGHT, Color.Red, 1, Color.DarkRed);
            Texture2D blueBrick = TextureUtils.GenerateTexureWithBorder(BRICK_WIDTH, BRICK_HEIGHT, Color.Blue, 1, Color.DarkBlue);

            for (int x = 0; x < TILE_X_COUNT; x++)
            for (int y = 0; y < TILE_Y_COUNT; y++)
            {
                Bricks.AddNode(new Sprite(((x + y) % 2 == 0) ? redBrick : blueBrick)
                {
                    Position = new Vector2(BRICK_WIDTH * x, BRICK_HEIGHT * y)
                });
            }

            Paddle = new Sprite(TextureUtils.GenerateTexture(300, 30, Color.White))
            {
                Y = Globals.ScreenHeight - 100,
                AutoCenter = true
            };

            AddNode(ball = new Ball());
            AddNode(Paddle);
        }
Пример #6
0
        private void AddScript(GameEntity gameEntity)
        {
            string scriptURL = (gameEntity as IScript).Url;

            gameEntity.AddNode(new ScriptNode(gameEntity, scriptURL));
        }