示例#1
0
        public Player(World parent)
        {
            inventory = new Inventory();

            //sets the initial conditions for the player
            this.Width = 23;
            this.Height = 40;
            this.Background = new SolidColorBrush(Color.FromRgb(65, 128, 200));
            this.VerticalAlignment = VerticalAlignment.Top;
            this.HorizontalAlignment = HorizontalAlignment.Left;
            this.parentWorld = parent;

            moveTimer.Interval = TimeSpan.FromMilliseconds(16);
            moveTimer.Tick += new EventHandler(moveTimer_Tick);

            moveTimer.Start();
            //this.MouseDown += (o, i) => { StartAnimation(new Movement(new Vector(-1, 0), 1)); }; //debug
        }
示例#2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //initializes a new world and generates it

            TextureCollection al = new TextureCollection();

            world = new World(Convert.ToInt32(137), Convert.ToInt32(200),gameGrid, al);

            dtGameTick.Tick += new EventHandler(dtGameTick_Tick);
            dtGameTick.Interval = new TimeSpan(0, 0, 0, 0, 16);
            dtGameTick.Start();
            Canvas.SetZIndex(canvas_shop, 98);
            store.Visibility = Visibility.Collapsed;

            store.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            store.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            canvas_shop.Background = new ImageBrush(world.textures.assets["shop"]);
        }