Example #1
0
 public WaterTile(TextureInfo texInfo)
     : base(texInfo)
 {
     _timer = new Timer();
     _delay = 3000;
     _timer.Reset();
 }
Example #2
0
        /// <summary>Director constructor.</summary>
        Director( uint sprites_capacity, uint draw_helpers_capacity, Sce.PlayStation.Core.Graphics.GraphicsContext context )
        {
            m_paused = false;
            m_frame_timer = new Timer();
            m_run_with_scene_called = false;
            m_elapsed = 0.0;

            GL = new GraphicsContextAlpha( context );
            DrawHelpers = new DrawHelpers( GL, draw_helpers_capacity );
            SpriteRenderer = new SpriteRenderer( GL, 6 * sprites_capacity );
            //DebugFlags |= GameEngine2D.DebugFlags.Log;

            m_canceled_replace_scene = new HashSet< Scene >();
        }
Example #3
0
        public EndScene()
        {
            _waitTimer = new Timer();
            ScheduleUpdate();
            _sceneCamera = (Camera2D)Camera;
            Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f);
            _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f);

            _groundLayer = new Layer(_sceneCamera);

            Animations = new Dictionary<string, Animation>();
            var texInfo = new TextureInfo(AssetManager.GetTexture("catanimation"), new Vector2i(5,1),TRS.Quad0_1);
            _currentAnimation = new Animation(0, 5, 0.1f, false);
            _currentAnimation.Play();

            _cat = new SpriteTile(texInfo);
            _cat.TileIndex1D = _currentAnimation.CurrentFrame;
            _cat.Quad.S = new Vector2(258, 214);
            _cat.CenterSprite();
            _cat.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X, _sceneCamera.CalcBounds().Point00.Y + _cat.TextureInfo.TextureSizef.Y/2 +64 );

            var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper")));
            background.Quad.S = background.TextureInfo.TextureSizef;
            background.CenterSprite();
            background.Position = _sceneCamera.CalcBounds().Center;

            for(var i = 0; i < 5; i++)
            {
                var _sprite = new GroundTile(new TextureInfo(AssetManager.GetTexture("ground_tile")));
                _groundLayer.AddChild(_sprite);
                _sprite.Quad.S = _sprite.TextureInfo.TextureSizef;
                _sprite.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X + i * _sprite.TextureInfo.TextureSizef.X, _sceneCamera.CalcBounds().Point00.Y - _sprite.TextureInfo.TextureSizef.Y / 2);
            }
            _musicPlayer = AssetManager.GetBGM("endscreen").CreatePlayer();
            _musicPlayer.Play();
            AddChild(background);
            AddChild (_cat);
            AddChild (_groundLayer);
        }
Example #4
0
        public TitleScene()
        {
            ScheduleUpdate();
            _nextSequence = false;
            _sleepTimer = new Timer();

            _sceneCamera = (Camera2D)Camera;
            Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f);
            _titleBackground = new SpriteTile(new TextureInfo(AssetManager.GetTexture("titlescreen")));
            _titleBackground.Quad.S = _titleBackground.TextureInfo.TextureSizef;
            _titleBackground.CenterSprite();
            _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f);

            var kid = new SpriteTile(new TextureInfo(AssetManager.GetTexture("kid")));
            kid.Quad.S = kid.TextureInfo.TextureSizef;
            kid.CenterSprite();
            kid.Position = _sceneCamera.CalcBounds().Center;

            _musicPlayer = AssetManager.GetBGM("title").CreatePlayer();
            _musicPlayer.Play();
            _titleBackground.Position = _sceneCamera.CalcBounds().Center;
            AddChild(kid);
            AddChild(_titleBackground);
        }
Example #5
0
        public static void Init()
        {
            ex = new List<Texture2D>();

            ex.Add(new Texture2D("/Application/textures/ex0.png", false));
            ex.Add(new Texture2D("/Application/textures/ex1.png", false));
            ex.Add(new Texture2D("/Application/textures/ex2.png", false));
            ex.Add(new Texture2D("/Application/textures/ex3.png", false));
            ex.Add(new Texture2D("/Application/textures/ex4.png", false));
            ex.Add(new Texture2D("/Application/textures/ex5.png", false));
            ex.Add(new Texture2D("/Application/textures/ex6.png", false));
            ex.Add(new Texture2D("/Application/textures/ex7.png", false));
            ex.Add(new Texture2D("/Application/textures/ex8.png", false));
            ex.Add(new Texture2D("/Application/textures/ex9.png", false));
            ex.Add(new Texture2D("/Application/textures/ex10.png", false));
            ex.Add(new Texture2D("/Application/textures/ex11.png", false));

            ballTexture = new Texture2D("/Application/textures/ss.png", false);
            ballTexture1 = new Texture2D("/Application/textures/^.png", false);
            backGround = new Texture2D("/Application/textures/bg.png", false);
            backGround1 = new Texture2D("/Application/textures/bgw.png", false);

               		player = new PlayerClass();
            player.bounds = new Vector2( Director.Instance.GL.Context.GetViewport().Width,
                                        Director.Instance.GL.Context.GetViewport().Height);

            cleanuptimer = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer();
            cleanuptimer.Reset();
            timer = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer();
            timer.Reset();
            timer1 = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer();
            counter = 0;
            FPS=0;
            firable = true;

            rand = new Random();
            uppercorner  = new Vector2(scene.Camera.CalcBounds().Center.X-460,scene.Camera.CalcBounds().Center.Y+220);
            var width = Director.Instance.GL.Context.GetViewport().Width;
               		var height = Director.Instance.GL.Context.GetViewport().Height;
            //init score
            img = new Image(ImageMode.Rgba, new ImageSize(width/3,height/10),
                         new ImageColor(255,255,0,0));
               			img.DrawText("Score: "+score.ToString()+"\nHighscore: "+highscore.ToString(),
                new ImageColor(255,0,0,255),
                new Font(FontAlias.System,20,FontStyle.Regular),
                new ImagePosition(0,0));

              			texturet = new Texture2D(width/3,height/10,false,
                                     PixelFormat.Rgba);

               			texturet.SetPixels(0,img.ToBuffer());
               			img.Dispose();

            dead = new List<SimpleDead>();
            for(int x = 0; x < 20; x++){

                dead.Add(new SimpleDead(ex,player.position,player.bounds));

            }

            shots = new List<ShotClass>();
            for(int x = 0; x < 100; x++){

                shots.Add(new ShotClass(player.position,Input2.GamePad0.AnalogRight,player.bounds));

            }

            enemies = new List<EnemyClass>();
            for(int x = 0; x < 30; x++){

                enemies.Add(new SimpleEnemy(player.bounds));

            }

            oThread = new Thread(new ThreadStart(Updating1));
            oThread.Start();
            pThread= new Thread( new ThreadStart(Updating2));
            pThread.Start();
        }
Example #6
0
        public GamePlayScene()
        {
            this.ScheduleUpdate ();
            _garnishTimer = new Timer();
            _groundTimer = new Timer();
            _waterLevel = 272;
            _groundLevel = 120;
            _random = new Random();
            _garnishDelay = _random.Next(0,5);

            Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f);
            SceneCamera = (Camera2D)Camera;

            SceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f);

            _groundGarnish = new Layer(SceneCamera);
            _mainLayer = new Layer(SceneCamera);
            _playerCreature = new PlayerCreature ();
            _playerCreature.sprite.Position = Camera.CalcBounds ().Center;
            _mainLayer.AddChild (_playerCreature.sprite);

            _backgroundLayer = new Layer(SceneCamera, 0, 0);
            var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper")));
            _backgroundLayer.AddChild(background);
            background.Quad.S = background.TextureInfo.TextureSizef;
            background.CenterSprite();
            background.Position = SceneCamera.CalcBounds().Center;

            _water = new SpriteTile(new TextureInfo(AssetManager.GetTexture("water")));
            _water.Quad.S = _water.TextureInfo.TextureSizef;
            _water.CenterSprite();
            _water.Position = SceneCamera.CalcBounds().Center + new Vector2(0, -244);

             _waterTop = new WaterTile(new TextureInfo(AssetManager.GetTexture("waveline")));
            _waterTop.Quad.S = _waterTop.TextureInfo.TextureSizef;
            _waterTop.CenterSprite();
            _waterTop.Position = _water.Position + new Vector2(0 ,_water.TextureInfo.TextureSizef.Y /2 );
            _waterTop.Position = SceneCamera.CalcBounds().Center + new Vector2(0, -244 + _water.TextureInfo.TextureSizef.Y/2f);

            _groundLayer = new Layer(SceneCamera, 1, 1);
            _groundGarnish = new Layer(SceneCamera, 1, 1);

            var texInfo = new TextureInfo(AssetManager.GetTexture ("ground_tile"));
            _ground = new SpriteList(texInfo);
            _sprite = new SpriteTile(texInfo);
            _ground.AddChild(_sprite);
            _sprite.Quad.S = texInfo.TextureSizef;
            _sprite.CenterSprite();
            _sprite.TileIndex2D = new Vector2i(0,0);

            GenerateMap();

            _enemies = new List<Enemy>();
            _bullets = new List<Bullet>();
            /*
            // enemy sprite test code
            var fish0 = new FishEnemy (new Vector2 (30.0f, 30.0f), _playerCreature);
            var fish1 = new FishEnemy (new Vector2 (15.0f, 15.0f), _playerCreature);
            var fish2 = new FishEnemy (new Vector2 (100.0f, 70.0f), _playerCreature);

            _enemies.Add (fish0);
            _enemies.Add (fish1);
            _enemies.Add (fish2);
            */
            var dummyFish = new FishEnemy (new Vector2 (-25.0f, -25.0f), _playerCreature);
            dummyFish.sprite.UnscheduleAll();
            _mainLayer.AddChild (FishEnemy.spriteList);

            var dummyBullet = new Bullet(new Vector2(-25.0f,-25.0f));
            dummyBullet.sprite.UnscheduleAll();
            //dummyBullet.sprite.Visible = false;
            _mainLayer.AddChild(Bullet.spriteList);

            _waterLayer = new Layer(SceneCamera);
            _waterLayer.AddChild(_water);
            _waterLayer.AddChild(_waterTop);

            _musicPlayer = AssetManager.GetBGM("gameplaymusic").CreatePlayer();
            _musicPlayer.Loop = true;
            _musicPlayer.Play();

            AddChild (_backgroundLayer);

            AddChild (_mainLayer);
            AddChild(_groundLayer);
            AddChild(_groundGarnish);
            AddChild(_waterLayer);

            _eventManager = new EventManager(_mainLayer,_playerCreature);
        }