Ejemplo n.º 1
0
        override public void update()
        {
            if (FlxG.mouse.justPressed())
            {
            }
            if (record)
            {
                if (visible && FlxG.mouse.justPressed())
                {
                    //Console.WriteLine("ballPositions.Add(new Vector2(" + FlxG.mouse.x + "," + FlxG.mouse.y + "));");
                    //_path.add(0,0);


                    Console.WriteLine("_path.add(" + FlxG.mouse.x + "," + FlxG.mouse.y + ");");
                }
            }
            else
            {
                if (ball.x > 224)
                {
                    visible = false;
                }

                //ball.x = ballPositions[ballPositionCounter].X;
                //ball.y = ballPositions[ballPositionCounter].Y;
                //if (visible)
                //{
                //    ballPositionCounter++;
                //}

                //if (ballPositionCounter > ballPositions.Count - 1)
                //{
                //    ballPositionCounter = 0;
                //    visible = false;
                //}
            }

            ball.update();

            base.update();
        }
Ejemplo n.º 2
0
        override public void update()
        {
            coinCounter.text = Lemonade_Globals.coins.ToString();

            tween.Update(FlxG.elapsedAsGameTime);

            coin.update();
            coinCounter.update();
            toastySprite.update();

            coin.y = tween.Position;
            //coinCounter.y = tween.Position;

            int count = 1;

            foreach (FlxSprite item in powerBar.members)
            {
                if (count > Lemonade_Globals.totalTimeAvailable)
                {
                    item.visible = false;
                }
                if (count > time)
                {
                    if (item.color == Lemonade_Globals.GAMEBOY_COLOR_1 && count < 4)
                    {
                        FlxG.play("Lemonade/sfx/cw_sound09");
                    }
                    else if (item.color == Lemonade_Globals.GAMEBOY_COLOR_1)
                    {
                        //Console.WriteLine("Coins per minute {0}", coinsPerMinute);

                        if (coinsPerMinute > 2.5f)
                        {
                            toastySprite.velocity.Y = -200;

                            Lemonade_Globals.coinsThisLevel = 0;

                            FlxG.play("Lemonade/sfx/cw_sound12", 0.25f, false);
                            FlxG.play("Lemonade/sfx/cw_sound15", 0.44f, false);

                            FlxG.quake.start(0.005f, 0.5f);
                        }
                    }
                    item.color = Lemonade_Globals.GAMEBOY_COLOR_4;
                }

                else
                {
                    item.color = Lemonade_Globals.GAMEBOY_COLOR_1;
                }

                item.update();
                count++;
            }

            if (time <= 0.5f)
            {
                if (FlxU.random() < 0.1f)
                {
                    FlxG.play("Lemonade/sfx/cw_sound09");
                }
            }

            if (toastySprite.y < FlxG.height - 180)
            {
                toastySprite.velocity.Y *= -1;
            }

            base.update();

            if (canStart)
            {
                int mult = 1;

                if (FlxG.keys.F5)
                {
                    mult = 10;
                }

                time -= FlxG.elapsed * mult;

                totalTime += FlxG.elapsed;
            }

            coinsPerMinute = Lemonade_Globals.coinsThisLevel / totalTime;
        }