Beispiel #1
0
 public Dude(Texture2D texture, Random PassRandom, Cloud player)
 {
     Texture = texture;
     random = PassRandom;
     happy = 100;
     int WindRain = random.Next(3);
     if (WindRain == 0)
     {
         dispLight = (random.NextDouble() + 0.1f) * 2;
         dispWind = 0;
     }
     else
     {
         dispLight = 0;
         dispWind = (random.NextDouble() + 0.1f) * 2;
     }
     disp = (random.NextDouble() + 0.1f) * 2;
     Position = new Vector2(10 + (float)(random.NextDouble() * 200.0f), 460 + (float)random.NextDouble() * 8);
     frames = 0;
     posInc = 200;
     Player = player;
     inCrowd = true;
     rotation = 0;
     jumper = 0;
 }
Beispiel #2
0
        public Crowd(int number, List<Texture2D> dudes, Cloud player)
        {
            Number = number;
            count = number;
            Dudes = dudes;
            random = new Random();
            happy = 100;
            randDudes = new List<Dude>();

            for (int i = 0; i < Number; i++)
            {
                randDudes.Add(new Dude(Dudes.ElementAt((int)(random.NextDouble() * Dudes.Count)), random, player));
            }
        }
Beispiel #3
0
 public void Reset()
 {
     lightening = 0;
     dudeHit = -1;
     timeCounter = 0;
     score = 0;
     directionX = -10;
     directionTitle = -20;
     directionEnd = 20;
     directionY = 10;
     wind.Stop();
     rain.Stop();
     player = new Cloud(clouds);
     crowd = new Crowd(50, dudes, player);
     title = true;
     gameOver = false;
     speechIndex[0] = -1;
     speechIndex[1] = 0;
     speechCounter = 0;
     speechDrawn = false;
     rain.Play();
     sky = Color.White;
 }
Beispiel #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            oldState = Keyboard.GetState();

            //cloud textures
            clouds = new List<Texture2D>();
            clouds.Add(Content.Load<Texture2D>("SunCloud"));
            clouds.Add(Content.Load<Texture2D>("RainCloud"));
            clouds.Add(Content.Load<Texture2D>("StormCloud"));
            player = new Cloud(clouds);

            //engines
            List<Texture2D> textures = new List<Texture2D>();
            textures.Add(Content.Load<Texture2D>("circle"));
            particleEngine = new ParticleEngine(textures, new Vector2(400, 150));
            titleEngine = new ParticleEngine(textures, new Vector2(400, -10));
            textures = new List<Texture2D>();
            textures.Add(Content.Load<Texture2D>("leaf"));
            leafEngine = new LeafEngine(textures, new Vector2(860, 200));
            endEngine = new LeafEngine(textures, new Vector2(860, 200));

            //text and other var
            font = Content.Load<SpriteFont>("Font1");
            font2 = Content.Load<SpriteFont>("Font2");
            BG = Content.Load<Texture2D>("BG");
            lightening = 0;
            light = Content.Load<Texture2D>("Light1");
            dudeHit = -1;
            bar0 = Content.Load<Texture2D>("Bar/Bar00");
            timeCounter = 0;
            score = 0;
            directionX = -10;
            directionY = 10;
            directionTitle = -20;
            directionEnd = 20;
            title = true;
            TitleScreen = Content.Load<Texture2D>("TitleScreen2");
            titleBG = Content.Load<Texture2D>("TitleBG");
            splashScreen = Content.Load<Texture2D>("Splash");
            gameOver = false;
            End = Content.Load<Texture2D>("GameOver1");
            EndBG = Content.Load<Texture2D>("GameOverBG");
            sky = Color.White;
            splash = 1;

            //happy bar
            bars = new List<Texture2D>();
            bars.Add(Content.Load<Texture2D>("Bar/Bar10"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar20"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar30"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar40"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar50"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar60"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar70"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar80"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar90"));
            bars.Add(Content.Load<Texture2D>("Bar/Bar100"));

            //construct crowd
            dudes = new List<Texture2D>();
            dudes.Add(Content.Load<Texture2D>("Dude/Dude1"));
            dudes.Add(Content.Load<Texture2D>("Dude/Dude2"));
            dudes.Add(Content.Load<Texture2D>("Dude/Dude3"));
            dudes.Add(Content.Load<Texture2D>("Dude/Dude4"));
            dudes.Add(Content.Load<Texture2D>("Dude/Dude5"));
            crowd = new Crowd(50, dudes, player);

            //audio
            thunder = new List<SoundEffect>();
            thunder.Add(Content.Load<SoundEffect>("Sound/Thunder1"));
            thunder.Add(Content.Load<SoundEffect>("Sound/Thunder2"));
            thunder.Add(Content.Load<SoundEffect>("Sound/Thunder3"));
            rain = Content.Load<SoundEffect>("Sound/Rain").CreateInstance();
            rain.IsLooped = true;
            rain.Play();
            wind = Content.Load<SoundEffect>("Sound/Wind").CreateInstance();
            wind.IsLooped = true;
            wind.Volume = 0.7f;
            song = Content.Load<Song>("Parity_Bit");
            songLength = song.Duration;

            //speech
            speechIndex[0] = -1;
            speechIndex[1] = 0;
            speech = new List<Texture2D>();
            speech.Add(Content.Load<Texture2D>("Speech/SpeechHappy"));
            speech.Add(Content.Load<Texture2D>("Speech/SpeechSad"));
            speech.Add(Content.Load<Texture2D>("Speech/SpeechRain"));
            speech.Add(Content.Load<Texture2D>("Speech/SpeechLight"));
            speech.Add(Content.Load<Texture2D>("Speech/SpeechWind"));
            speechDrawn = false;
            speechCounter = 0;
        }
Beispiel #5
0
        public int[] Update(Cloud player)
        {
            happy = 0;
            for (int i = 0; i < randDudes.Count; i++)
            {
                count += randDudes[i].Update();
                happy += randDudes[i].happy;
            }
            happy /= randDudes.Count;

            int[] array = new int[2];
            if (random.Next(240) == 120) //speech
            {
                Dude temp = randDudes[random.Next(randDudes.Count)];
                array[1] = (int)temp.Position.X;
                if (!temp.inCrowd)
                {
                    array[0] = -1;
                    return array;
                }
                if (temp.happy > 50)
                {
                    array[0] = 0;
                    return array;
                }
                else if (temp.dispWind == 0 && player.isLightening)
                {
                    array[0] = 3;
                    return array;
                }
                else if (temp.dispLight == 0 && player.isWind)
                {
                    array[0] = 4;
                    return array;
                }
                else if (player.isRaining)
                {
                    array[0] = 2;
                    return array;
                }
                else if (temp.happy < 50)
                {
                    array[0] = 1;
                    return array;
                }
                else
                {
                    array[0] = -1;
                    return array;
                }
            }
            else
            {
                array[0] = -1;
                array[1] = 0;
                return array;
            }
        }