示例#1
0
        public Bike(Level level, double x, double y)
        {
            this.level = level;
            this.physics = level.physics;

            Create(x, y);
            dead = false;
        }
示例#2
0
 public void AttachToLevel(Level level)
 {
     this.level = level;
     this.physics = level.physics;
     Reset();
 }
示例#3
0
        public void LevelReady(ResourceDownloader rd)
        {
            level = new Level(levels[currentLevel].Name, game.world, game.foreground, game.background);

            Downloader foreground = rd.FindItem(levels[currentLevel].Name, "foreground.xaml");
            level.ForegroundSource = foreground.GetResponseText("");
            Downloader background = rd.FindItem(levels[currentLevel].Name, "background.xaml");
            level.BackgroundSource = background.GetResponseText("");
            Downloader entities = rd.FindItem(levels[currentLevel].Name, "entities.py");
            level.EntitiesSource = entities.GetResponseText("");
            Downloader logic = rd.FindItem(levels[currentLevel].Name, "logic.py");
            level.LogicSource = logic.GetResponseText("");

            RestartLevel();
            UpdateIDE();

            StartTimers();
        }
示例#4
0
        public void Init(Canvas root)
        {
            Current = this;
            this.content = root;

            // register the scriptable endpoints
            WebApplication.Current.RegisterScriptableObject("page", this);

            game = new Game(root);
            stats = new Stats(root);
            help = new Help(root);

            level = new Level("__empty__", game.world, game.foreground, game.background);

            Canvas gamehost = root.FindName("gamehost") as Canvas;
            gamehost.Children.Add(game);

            Canvas statshost = root.FindName("statshost") as Canvas;
            statshost.Children.Add(stats);

            Canvas helphost = root.FindName("helphost") as Canvas;
            helphost.Children.Add(help);

            continueInfo = root.FindName("continue") as Canvas;

            timer.Attach(root, "game-loop", new Timer.TickDelegate(GameTick), new TimeSpan(TimeSpan.TicksPerSecond/120));

            keyboard.Init(root, new Keyboard.KeyEventDelegate(KeyPress));

            SwitchLevel(levels[currentLevel]);
        }