Example #1
0
        public EmitterTestingRoom()
        {
            emitterList = new SelectionList(typeof(EmitterTypes));
            groupList   = new SelectionList(typeof(EmitterGroupTypes));

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.MOUSE, this));
        }
Example #2
0
        public ParticleHelper(List <Particle> particles)
        {
            this.particles = particles;

            ashSpawner = new AshSpawner(particles);

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.RESET, this));
        }
Example #3
0
        public HeightDisplay()
        {
            text = new Text(ContentLoader.LoadFont("Height"), "0", new Vector2(Constants.SCREEN_WIDTH / 2, VERTICAL_OFFSET),
                            OriginLocations.CENTER, Color.Black);
            maxHeightReached = -1;

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.RESET, this));
        }
Example #4
0
        public CollisionHelper(Player player, Lava lava, List <Platform> platforms, List <Hazard> hazards)
        {
            this.player    = player;
            this.lava      = lava;
            this.platforms = platforms;
            this.hazards   = hazards;

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.RESET, this));
        }
Example #5
0
        public PlatformHelper(List <Platform> platforms, Lava lava)
        {
            this.platforms = platforms;
            this.lava      = lava;

            setPieces = new List <SetPiece>();
            random    = new Random();

            SetPiece.Initialize(platforms);

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.RESET, this));
        }
Example #6
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = Constants.SCREEN_WIDTH;
            graphics.PreferredBackBufferHeight = Constants.SCREEN_HEIGHT;

            Content.RootDirectory = "Content";
            Window.Title          = "Platformer";
            IsMouseVisible        = true;

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.EXIT, this));
            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.GAMESTATE, this));
        }
Example #7
0
        public void RegisterDamage(CollisionDirections direction)
        {
            health--;

            if (health == 0)
            {
                SimpleEvent.AddEvent(EventTypes.RESET, null);
            }
            else
            {
                switch (direction)
                {
                case CollisionDirections.UP:
                    if (velocity.Y < COLLISION_LAUNCH_SPEED_VERTICAL)
                    {
                        velocity.Y = COLLISION_LAUNCH_SPEED_VERTICAL;
                    }

                    break;

                case CollisionDirections.DOWN:
                    if (velocity.Y > -COLLISION_LAUNCH_SPEED_VERTICAL)
                    {
                        velocity.Y = -COLLISION_LAUNCH_SPEED_VERTICAL;
                    }

                    break;

                case CollisionDirections.LEFT:
                    velocity.X = COLLISION_LAUNCH_SPEED_HORIZONTAL;

                    break;

                case CollisionDirections.RIGHT:
                    velocity.X = -COLLISION_LAUNCH_SPEED_HORIZONTAL;

                    break;
                }

                if (doubleJumpActive)
                {
                    doubleJumpEnabled = true;
                    doubleJumpActive  = false;
                }
            }
        }
Example #8
0
        public Lava(GraphicsDevice graphicsDevice)
        {
            this.graphicsDevice = graphicsDevice;

            whitePixel     = ContentLoader.LoadTexture("WhitePixel");
            totalAscension = -Constants.SCREEN_HEIGHT;
            increment      = (float)Constants.SCREEN_WIDTH / NUM_SEGMENTS;
            random         = new Random();

            basicEffect                    = new BasicEffect(graphicsDevice);
            basicEffect.Projection         = Matrix.CreateOrthographicOffCenter(0, Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT, 0, 0, 1);
            basicEffect.VertexColorEnabled = true;

            GeneratePoints();
            GenerateSineWaves();
            ComputeVertexData();

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.RESET, this));
        }
Example #9
0
        private void InitializeGameplay()
        {
            heightDisplay = new HeightDisplay();
            player        = new Player(heightDisplay);
            lava          = new Lava(GraphicsDevice);
            background    = new Background();

            List <Platform> platforms = new List <Platform>();
            List <Hazard>   hazards   = new List <Hazard>();
            List <Particle> particles = new List <Particle>();

            platformHelper  = new PlatformHelper(platforms, lava);
            collisionHelper = new CollisionHelper(player, lava, platforms, hazards);
            particleHelper  = new ParticleHelper(particles);

            Platform.Initialize(hazards);
            ParticleFactory.Initialize(particles);

            SimpleEvent.AddEvent(EventTypes.RESET, null);
        }
Example #10
0
        public Player(HeightDisplay heightDisplay)
        {
            this.heightDisplay = heightDisplay;

            Texture2D texture = ContentLoader.LoadTexture("Player");

            int width  = texture.Width;
            int height = texture.Height;

            sprite         = new Sprite(texture, position);
            halfBounds     = new Vector2(width, height) / 2;
            OldBoundingBox = new BoundingBox2D(position, width, height);
            NewBoundingBox = new BoundingBox2D(position, width, height);
            heightOffset   = int.MinValue;

            ResetValues();

            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.KEYBOARD, this));
            SimpleEvent.AddEvent(EventTypes.LISTENER, new ListenerEventData(EventTypes.RESET, this));
        }
Example #11
0
 private void EndFadeOut()
 {
     ChangeFadeState(FadeStates.NONE, Color.Transparent, GAMESTATE_DELAY, () => {
         SimpleEvent.AddEvent(EventTypes.GAMESTATE, Gamestates.TITLE);
     });
 }