コード例 #1
0
ファイル: attackGame.cs プロジェクト: ivpusic/ProFlightXNA
        //public GameplayHelper helper, temp;
        public attackGame()
        {
            hel = hel as GameplayHelper;
            _To = "ovo jebeno izgleda da radi";
            graphics = new GraphicsDeviceManager(this);
            PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
            phoneAppService.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            graphics.IsFullScreen = true;
            //Set the Windows Phone screen resolution
            graphics.PreferredBackBufferWidth = 480;
            graphics.PreferredBackBufferHeight = 800;
            //
            Content.RootDirectory = "Content";
            backScreen = new SplashScreen();
            loadingScreen = new LoadingScreen(1,2);
            //helper = helper as GameplayHelper;
            //temp = temp as GameplayHelper;
            // Hook up lifecycle events

            PhoneApplicationService.Current.Launching += new EventHandler<LaunchingEventArgs>(Current_Launching);
            PhoneApplicationService.Current.Activated += new EventHandler<ActivatedEventArgs>(Current_Activated);
            //PhoneApplicationService.Current.Closing += new EventHandler<ClosingEventArgs>(Current_Closing);
            PhoneApplicationService.Current.Deactivated += new EventHandler<DeactivatedEventArgs>(Current_Deactivated);

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);

            //Create a new instance of the Screen Manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
            //Debug.WriteLine("konstruktor");
        }
コード例 #2
0
ファイル: AlienGame.cs プロジェクト: deanwilliams/AlienGame
        public AlienGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 480;
            graphics.PreferredBackBufferHeight = 800;
            Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            // Create new instance of the screen manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // Add two new screens
            screenManager.AddScreen(new BackgroundScreen());
            screenManager.AddScreen(new LoadingScreen());
        }
コード例 #3
0
ファイル: AlienGame.cs プロジェクト: timdetering/AlienGameXNA
        public AlienGame()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth = 240;
            graphics.PreferredBackBufferHeight = 320;

            Content.RootDirectory = "Content";

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // Add the background screen
            screenManager.AddScreen(new BackgroundScreen());

            // This loading screen pre-loads all content the game needs.  It
            // doesn't draw anything, so the user sees the background screen
            // then the title and menus pop up.
            screenManager.AddScreen(new LoadingScreen());
        }
コード例 #4
0
        public AlienGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // Zune use 30 frames per second
            this.TargetElapsedTime = TimeSpan.FromSeconds(1/30.0f);

            // The assets need to be stretched...put some quality
            graphics.PreferMultiSampling = true;

            // Add the background screen
            screenManager.AddScreen(new BackgroundScreen());

            // This loading screen pre-loads all content the game needs.  It
            // doesn't draw anything, so the user sees the background screen
            // then the title and menus pop up.
            screenManager.AddScreen(new LoadingScreen());
        }
コード例 #5
0
ファイル: AlienGame.cs プロジェクト: Kermo/Win7Phone
        public AlienGame()
        {
            graphics = new GraphicsDeviceManager(this);

            //Set the Windows Phone screen resolution
            graphics.PreferredBackBufferWidth = 480;
            graphics.PreferredBackBufferHeight = 800;

            Content.RootDirectory = "Content";

            // Hook up lifecycle events
            PhoneApplicationService.Current.Launching += Game_Launching;
            PhoneApplicationService.Current.Activated += Game_Activated;
            PhoneApplicationService.Current.Closing += Game_Closing;

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);

            //Create a new instance of the Screen Manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
        }
コード例 #6
0
ファイル: attackGame.cs プロジェクト: ivpusic/ProFlightXNA
        void Current_Activated(object sender, ActivatedEventArgs e)
        {
            Debug.WriteLine("activating event...");
            if (PhoneApplicationService.Current.State.ContainsKey("loading"))
            {

            }

            //if (MediaPlayer.State == MediaState.Playing) isBackgroundSong = true;

            backScreen = PhoneApplicationService.Current.State["background"] as SplashScreen;
            loadingScreen = PhoneApplicationService.Current.State["loading"] as LoadingScreen;

            if (PhoneApplicationService.Current.State.ContainsKey("Unsaved_To"))
            {
                tem = hel;
                attackGame.GameplayHelper = hel;
                //tem  = PhoneApplicationService.Current.State["Unsaved_To"] as GameplayHelper;
                PhoneApplicationService.Current.State.Remove("Unsaved_To");
                Debug.WriteLine("ima");
            }

            ReloadRequired = true;

            //PhoneApplicationService.Current.State[InGameKey] = true;

            screenManager = new ScreenManager(this);

            // Display the main screen
            screenManager.AddScreen(new SplashScreen());
            screenManager.AddScreen(new LoadingScreen());
        }
コード例 #7
0
        /// <summary>
        /// Input helper method provided by GameScreen.  Packages up the various input
        /// values for ease of use.  Here it checks for pausing and handles controlling
        /// the player's tank.
        /// </summary>
        /// <param name="input">The state of the gamepads</param>
        public override void HandleInput(InputState input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (input.PauseGame)
            {
                if (gameOver == true)
                {
                    MediaPlayer.Stop();

                    foreach (GameScreen screen in ScreenManager.GetScreens())
                    {
                        screen.ExitScreen();
                    }

                    ScreenManager.AddScreen(new BackgroundScreen());
                    ScreenManager.AddScreen(new MainMenuScreen());
                }
                else
                {
                    ScreenManager.AddScreen(new PauseMenuScreen());
                }
            }
            else
            {
                bool touchShoot = false;

                                #if TARGET_IPHONE_SIMULATOR
                // This section handles tank movement.  We only allow one "movement" action
                // to occur at once so that touchpad devices don't get double hits.
                player.Velocity.X = MathHelper.Min(input.CurrentGamePadStates.ThumbSticks.Left.X * 2.0f, 1.0f);
                touchShoot        = input.MenuSelect;
                                #else
                // Add the accelerometer support
                player.Velocity.X = MathHelper.Min(Accelerometer.GetState().Acceleration.X * 2.0f, 1.0f);

                // tap the screen to shoot
                foreach (TouchLocation location in input.TouchStates)
                {
                    switch (location.State)
                    {
                    case TouchLocationState.Pressed:
                        touchShoot = true;
                        break;

                    case TouchLocationState.Moved:
                        break;

                    case TouchLocationState.Released:
                        break;
                    }
                }
                                #endif



                if (touchShoot)
                {
                    //Mouse.SetPosition(0,0);
                    if (player.FireTimer <= 0.0f && player.IsAlive && !gameOver)
                    {
                        Bullet bullet = CreatePlayerBullet();
                        bullet.Position  = new Vector2((int)(player.Position.X + player.Width / 2) - bulletTexture.Width / 2, player.Position.Y - 4);
                        bullet.Velocity  = new Vector2(0, -256.0f);
                        player.FireTimer = 0.5f;
                        particles.CreatePlayerFireSmoke(player);
                        playerFired.Play();
                    }
                }
            }
        }