public void Update(Map karte, GameTime gameTime, Camera camera)
        {
            luaTop = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Top"]);
            luaBottom = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Bottom"]);
            luaAmount = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Amount"]);
            luaChaos = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Chaos"]);
            luaType = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Type"]);
            luaWind = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Wind"]);
            luaSizeMin = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "SizeMin"]);
            luaSizeMax = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "SizeMax"]);
            size.X = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Width"]);
            size.Y = Convert.ToInt32((double)Game1.luaInstance["cloudPlane" + number.ToString() + "Height"]);

            position.X = camera.viewport.X - ((size.X - camera.viewport.Width) * (camera.viewport.X / (karte.size.X - camera.viewport.Width)));
            position.Y = camera.viewport.Y - ((size.Y - camera.viewport.Height) * (camera.viewport.Y / (karte.size.Y - camera.viewport.Height)));

            //Spawntimer
            if (Game1.time.TotalMilliseconds > spawnTimer + ((100000 - (float)luaAmount) * ((100 - (float)luaChaos) / 100)))
            {
                spawnTimer = Game1.time.TotalMilliseconds;
                SpawnCloud(karte, camera);
            }

            //Wolken updaten
            for (int i = 0; i < clouds.Count(); i++)
            {
                Cloud cloud = clouds.ElementAt(i);
                cloud.Update(luaWind);
                if (cloud.position.X < -cloud.cuttexture.Width)
                {
                    clouds.Remove(cloud);
                }
            }
        }
 public void getHit(GameTime gameTime,Map map,Vector2 hposition,string animation)
 {
     lifes--;
     Game1.leben = lifes;
     if (lifes != 0)
     {
         Sound.Play("sweetcheeks_hit");
         if (hposition.X > position.X)
             hitrichtung = false;
         else
             hitrichtung = true;
         ishit = true;
         flytime = 0;
         spine.Clear(0);
         spine.anim("jump", 0, false);
         Jump(gameTime, map); //Springen!
         savejump = false;
     }
     else
     {
         ishit = true;
         spine.Clear(0);
         Sound.Play("sweetcheeks_dying");
         spine.anim("die", 3, false);
         dietime = 2;
     }
 }
 public void Update(ContentManager Content, Map map, Camera camera)
 {
     //Position = Viewportposition - (Position wenn am Ende am Maprand * Positionsfaktor abhängig von Viewportposition/letzte Mapposition)
     position.X = camera.viewport.X - ((size.X - camera.viewport.Width) * (camera.viewport.X / (map.size.X - camera.viewport.Width)));
     position.Y = camera.viewport.Y - ((size.Y - camera.viewport.Height) * (camera.viewport.Y / (map.size.Y - camera.viewport.Height))) + additionalHeight;
     //TextureManager(Content, camera);
 }
 public void Move(int deltax, int deltay, Map map) //Falls Input, bewegt den Spieler
 {
     Vector2 domove = new Vector2(0, 0);
     domove = CollisionCheckedVector(deltax, deltay, map.blocks);
     position.X += domove.X;
     position.Y += domove.Y;
     cbox.Update(position);
 }
 public override void Update(GameTime gameTime, Map map)
 {
     int speedx = 20;
     if (!richtung)
     {
         speedx = -speedx;
     }
     //Formel: y = x*x
     position.X += speedx;
     box.X = (int)position.X;
     box.Y = (int)position.Y;
 }
 public override void Update(GameTime gameTime, Map map)
 {
     y++;
     int speedx = Convert.ToInt32((double)Game1.luaInstance["kackeSpeed"]);
     if (!richtung)
     {
         speedx = -speedx;
     }
     int speedy = y;
     //Formel: y = x*x
     position.X += speedx;
     position.Y += speedy;
     box.X = (int)position.X;
     box.Y = (int)position.Y;
 }
 public override void Update(GameTime gameTime, Map map)
 {
     if (fall)
     {
         if (falltimer == 0)
             falltimer = Game1.time.TotalMilliseconds;
         float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
         int gravitation = Convert.ToInt32((double)Game1.luaInstance["objectGravitation"]);
         position.Y += (gravitation * t);
         box.Y = (int)position.Y;
         for (int i = 0; i < map.objects.Count(); i++)
         {
             Obj obj = map.objects.ElementAt(i);
             if(obj.box.Intersects(box)&&obj != this&&obj.type == 3)
             {
                 map.objects.Remove(obj);
             }
         }
     }
 }
 public override void Update(GameTime gameTime, Map map)
 {
     foreach (MovingBlock block in map.mblocks)
     {
         Rectangle collide = new Rectangle(box.X, box.Y + 1, box.Width, box.Height);
         //Wenn Kollision vorliegt: Keinen weiteren Block abfragen
         int movespeed = Convert.ToInt32((double)Game1.luaInstance["blockSpeed"]);
         if (block.move == 2)
             movespeed = -movespeed;
         if (collide.Intersects(block.cbox))
         {
             if (GameScreen.slow != 0)
             {
                 movespeed = movespeed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
             }
             position.X += movespeed;
             box.X += movespeed;
             break;
         }
     }
 }
 public void Load(ContentManager Content, string textureName, Map karte, Camera camera)
 {
     cloudTexture = Content.Load<Texture2D>("sprites/Level_1/Planes/" + textureName);
     spawnTimer = 0;
     for (int i = 0; i <= size.X / luaWind; i++)
     {
         if (spawnTimer > (((100000 - (float)luaAmount) * ((100 - (float)luaChaos) / 100)) / 30))
         {
             spawnTimer = 0;
             SpawnCloud(karte, camera);
         }
         //Wolken updaten
         for (int t = 0; t < clouds.Count(); t++)
         {
             Cloud cloud = clouds.ElementAt(t);
             cloud.Update(luaWind);
             if (cloud.position.X < -cloud.cuttexture.Width)
             {
                 clouds.Remove(cloud);
             }
         }
         spawnTimer++;
     }
 }
Ejemplo n.º 10
0
 public virtual void Update(GameTime gameTime, Map map, Vector2 heropos)
 {
 }
Ejemplo n.º 11
0
        public override void Update(GameTime gameTime, Map map, Vector2 heropos)
        {
            speed = Convert.ToInt32((double)Game1.luaInstance["bunnySpeed"]);
            if (GameScreen.slow != 0)
            {
                speed = speed /Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
            }
            gravitation = Convert.ToInt32((double)Game1.luaInstance["bunnyGravitation"]);
            if (mover)
            {
                if (CollisionCheckedVector(speed, 0, map.blocks).X != 0)
                {
                    Move(speed, 0, map);//Bewege Rechts
                    if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                    {
                        mover = false;
                        Move(-speed, 0, map);
                    }
                }
                else
                {
                    mover = false;
                }
            }
            else
            {
                if (CollisionCheckedVector(-speed, 0, map.blocks).X != 0)
                {
                    Move(-speed, 0, map);//Bewege Links
                    if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                    {
                        mover = true;
                        Move(speed, 0, map);
                    }
                }
                else
                {
                    mover = true;
                }
            }
            if(mover)
                spine.anim("walk", 1, true);
            else
                spine.anim("walk", 2, true);
            //Gravitation
            if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
            {
                if (!fall)
                {
                    fall = true;
                    falltimer = Game1.time.TotalMilliseconds;
                }
                float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                Move(0, (int)((gravitation * t)), map); //v(t)=-g*t
            }
            else
            {
                fall = false;
            }
            foreach (MovingBlock block in map.mblocks)
            {
                Rectangle collide = new Rectangle(cbox.box.X, cbox.box.Y + 1, cbox.box.Width, cbox.box.Height);
                //Wenn Kollision vorliegt: Keinen weiteren Block abfragen
                int movespeed = Convert.ToInt32((double)Game1.luaInstance["blockSpeed"]);
                if (block.move == 2)
                    movespeed = -movespeed;
                if (collide.Intersects(block.cbox))
                {
                    if (GameScreen.slow != 0)
                    {
                        movespeed = movespeed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
                    }
                    Move(movespeed, 0, map);
                    break;
                }

                collide.Y = cbox.box.Y;
                collide.X = cbox.box.X - movespeed;
                if (collide.Intersects(block.cbox))
                {
                    if (CollisionCheckedVector(movespeed, 0, map.blocks).X == movespeed)
                    {
                        Move(movespeed, 0, map);
                        break;
                    }
                    else
                    {
                        if (block.move == 1)
                            block.move = 2;
                        else
                            block.move = 1;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 12
0
 public void Move(int deltax, int deltay, Map map) //Falls Input, bewegt den Spieler
 {
     Vector2 domove = new Vector2(0, 0);
     domove = CollisionCheckedVector(deltax, deltay, map.blocks);
     if (position.X + domove.X > 0 && position.X + domove.X < map.size.X)
     {
         spine.skeleton.X += domove.X;
         spine.skeleton.Y += domove.Y;
         position.Y = spine.skeleton.Y;
         position.X = spine.skeleton.X;
         cbox.Update(position);
     }
 }
Ejemplo n.º 13
0
 public void Jump(GameTime gameTime, Map map) //Deine Mudda springt bei Doodle Jump nach unten.
 {
     if (CollisionCheckedVector(0, -1, map.blocks).Y < 0)
     {
         if (!jump)
         {
             jump = true;
             jumptimer = Game1.time.TotalMilliseconds;
         }
         float t = (float)((Game1.time.TotalMilliseconds - jumptimer) / 1000);
         int deltay = (int)(-jumppower + (gravitation * t));
         if (deltay > 0)
         {
             jump = false;
             fall = true;
             falltimer = Game1.time.TotalMilliseconds;
         }
         else
         {
             Move(0, deltay, map); //v(t)=-g*t
         }
     }
     else
     {
         jump = false;
     }
 }
Ejemplo n.º 14
0
        public virtual void Update(GameTime gameTime, Map map,Rectangle spieler)
        {
            if (start)
            {
                if (slowtime != 0)
                {
                    slowtime -= gameTime.ElapsedGameTime.TotalSeconds;
                    if (slowtime < 0)
                    {
                        slowtime = 0;
                    }
                }
                speed = Convert.ToInt32((double)Game1.luaInstance["heroSpeed"]);
                int realspeed = Convert.ToInt32((double)Game1.luaInstance["heroKISpeed"]);
                if (GameScreen.slow != 0)
                {
                    speed = speed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
                }
                if (slowtime != 0)
                {
                    speed = speed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
                }
                airspeed = Convert.ToInt32((double)Game1.luaInstance["heroAirspeed"]);
                jumppower = Convert.ToInt32((double)Game1.luaInstance["heroJumppower"]);
                gravitation = Convert.ToInt32((double)Game1.luaInstance["heroGravitation"]);
                //Geschwindigkeit festlegen
                int actualspeed = speed;
                if (jump || fall)
                {
                    actualspeed = airspeed;
                }
                float spielerdistanz = spieler.X - position.X;
                kicollide = cbox.box;
                if (Math.Abs(spielerdistanz) < 240 && cbox.box.Y >= spieler.Y && cbox.box.Y - 480 <= spieler.Y + spieler.Height && !jump && !fall)
                {
                    if (breathtimer < 0)
                    {
                        Sound.Play("ashbrett_breath");
                        breathtimer = 10;
                    }
                    else
                    {
                        breathtimer -= gameTime.ElapsedGameTime.TotalMilliseconds/1000;
                    }
                    bool geht = true;
                    for (int i = 0; i < 10; i++)
                    {
                        kicollide.Y = cbox.box.Y - i *48;
                        foreach (Block block in map.blocks)
                        {
                            if (kicollide.Intersects(block.cbox) && block.block)
                            {
                                geht = false;
                                break;
                            }

                        }
                    }
                    if (geht)
                    {
                        if (kistate != 4 && kistate != 5)
                        {
                            kistate = 0;
                        }
                    }
                    else
                    {
                        if (kicheck.Count() != 0)
                        {
                            foreach (KIPoint kipoint in map.kipoints)
                            {
                                if (kipoint.id == kicheck.ElementAt(0).id)
                                    spieler = kipoint.cbox;
                            }
                        }
                    }
                }
                else
                {
                    Sound.Stop("ashbrett_breath");
                        if (kicheck.Count() != 0)
                        {
                            foreach (KIPoint kipoint in map.kipoints)
                            {
                                if (kipoint.id == kicheck.ElementAt(0).id)
                                    spieler = kipoint.cbox;
                            }
                        }
                }
                float punktdistanz = spieler.X - position.X;
                //sposition.X = map.size.X;
                //Vector2 Punkt = map.kipoints.ElementAt(kipoint).position;
               // sposition.X = Punkt.X;
                if (attacktimer > 0)
                {
                    attacktimer -= gameTime.ElapsedGameTime.TotalSeconds;
                }
                else
                {
                    //Wenn Spieler ist hinten bewege zurück
                    if (spieler.X < position.X)
                    {
                        actualspeed = -actualspeed;
                        realspeed = -realspeed;
                    }
                    if (!cbox.box.Intersects(spieler))
                    {
                        GameScreen.test = 0;
                        bool geht = false;
                        kicollide = cbox.box;
                        if (kistate == 0)
                        {
                            if (Math.Abs(spielerdistanz) < Convert.ToInt32((double)Game1.luaInstance["heroCloseWalkRange"]))
                            {
                                if (actualspeed > 0)
                                    spine.anim("close", 1, true);
                                else
                                    spine.anim("close", 2, true);
                            }
                            else
                            {
                                if (actualspeed > 0)
                                    spine.anim("walk", 1, true);
                                else
                                    spine.anim("walk", 2, true);
                            }
                            //KI ist auf den Boden und alles ist gut
                            //Schaue ob der Block rechts ist
                            if (kicheck.Count() != 0)
                            {
                                for (int i = 0; i < 50; i++)
                                {
                                    kicollide.X = cbox.box.X + i * realspeed;
                                    kicollide.Y = cbox.box.Y;
                                    foreach (KIPoint kipoint in map.kipoints)
                                    {
                                        if (kicollide.Intersects(kipoint.cbox) && kipoint.id == kicheck.ElementAt(0).id)
                                        {
                                            geht = true;
                                            break;
                                        }
                                    }
                                    if (geht)
                                        break;
                                }
                            }
                            //Block ist auf gleicher Höhe, bewege nur drauf zu
                            if (geht)
                            {
                                if (CollisionCheckedVector(actualspeed, 0, map.blocks).X == actualspeed)
                                {
                                    if (Math.Abs(spielerdistanz) > actualspeed * 2)
                                    {
                                        Move(actualspeed, 0, map);
                                    }
                                }
                                else
                                {
                                    if (!fall && !jump)
                                    {
                                        if (Math.Abs(spielerdistanz) < 240)
                                            Sound.Play("ashbrett_jumpinging");
                                        spine.anim("jump", 3, false);
                                        Jump(gameTime, map); //Springen!
                                        kistate = 3;
                                    }

                                }
                                if (kistate == 0&&CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                                {
                                    //AAAAHHH WIR fallen T_T
                                    //Hmm vielleicht ist da ja ein Block der für die bewegenden Plattformen zuständig ist?
                                    bool bewegblock = false;
                                    kicollide.Y += 1;
                                    foreach (Block block in map.blocks)
                                    {
                                        if (kicollide.Intersects(block.cbox) && block.type == "movingend")
                                        {
                                            bewegblock = true;
                                            //TATSACHE!!
                                            //Schaue ob rechts ein Block ist
                                        }
                                    }
                                    if (bewegblock && !fall && !jump)
                                    {
                                        //Warten wir einfach mal ...
                                        spine.anim("idle", 3, true);
                                        Move(-actualspeed, 0, map);
                                        kistate = 4;
                                    }
                                    //Beginne den Drüberspringmodus für Abgründe!!!HA!
                                    else
                                    {
                                        if (!fall && !jump)
                                        {
                                            if (Math.Abs(spielerdistanz) < 240)
                                                Sound.Play("ashbrett_jumping");
                                            Jump(gameTime, map); //Springen!
                                            kistate = 1;
                                        }
                                        else
                                        {
                                            Move(-actualspeed, 0, map);
                                        }
                                    }

                                }
                            }
                            else
                            {
                                GameScreen.test = 2;
                                if (spieler.Y < position.Y - 20)
                                {
                                    if (CollisionCheckedVector(realspeed, 0, map.blocks).X == realspeed)
                                    {
                                        bool bewegblock = false;
                                        kicollide.X = cbox.box.X;
                                        kicollide.Y += 1;
                                        foreach (Block block in map.blocks)
                                        {
                                            if (kicollide.Intersects(block.cbox) && block.type == "movingend")
                                            {
                                                if (spieler.X > position.X && block.cbox.X > position.X || spieler.X < position.X && block.cbox.X < position.X)
                                                    bewegblock = true;
                                                //TATSACHE!!
                                                //Schaue ob rechts ein Block ist
                                            }
                                        }
                                        if (bewegblock && !fall && !jump)
                                        {
                                            //Warten wir einfach mal ...
                                            spine.anim("idle", 3, true);
                                            Move(-actualspeed, 0, map);
                                            kistate = 4;
                                        }
                                        else
                                        {
                                            //Block ist über den Hero
                                            bool b = false;
                                            int deltay = 0;
                                            Rectangle kicollide2 = cbox.box;
                                            for (int i = 0; i < 60; i++)
                                            {
                                                float t = (float)(i / 22);
                                                deltay = deltay + (int)(-jumppower + (gravitation * t));
                                                kicollide.X = cbox.box.X + (i * realspeed);
                                                kicollide.Y = cbox.box.Y + deltay;
                                                kicollide2.X = cbox.box.X + (i * realspeed);
                                                if (kicollide.Intersects(spieler) && !kicollide2.Intersects(spieler))
                                                {
                                                    b = true;
                                                    break;
                                                }
                                            }
                                            if (b)
                                            {
                                                if (!fall && !jump)
                                                {
                                                    if (Math.Abs(spielerdistanz) < 240)
                                                        Sound.Play("ashbrett_jumping");
                                                    spine.anim("jump", 3, false);
                                                    Jump(gameTime, map); //Springen!
                                                    kistate = 2;
                                                }
                                                else
                                                {
                                                    Move(-actualspeed, 0, map);
                                                }
                                            }
                                            else
                                            {
                                                Move(actualspeed, 0, map);
                                                if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                                                {
                                                    Move(-actualspeed, 0, map);
                                                    if (!fall && !jump)
                                                    {
                                                        if (Math.Abs(spielerdistanz) < 240)
                                                            Sound.Play("ashbrett_jumping");
                                                        spine.anim("jump", 3, false);
                                                        Jump(gameTime, map); //Springen!
                                                        kistate = 2;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (!fall && !jump)
                                        {
                                            if (Math.Abs(spielerdistanz) < 240)
                                                Sound.Play("ashbrett_jumping");
                                            spine.anim("jump", 3, false);
                                            Jump(gameTime, map); //Springen!
                                            kistate = 3;
                                        }

                                    }
                                }
                                else
                                {
                                    if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                                    {
                                        for (int i = 0; i < 10; i++)
                                        {
                                            kicollide.X = cbox.box.X;
                                            kicollide.Y = cbox.box.Y + i * gravitation;
                                            if (kicollide.Intersects(spieler))
                                                geht = true;
                                        }
                                    }
                                    if (!geht)
                                    {
                                        if (Math.Abs(spielerdistanz) > actualspeed * 2)
                                        {
                                            Move(actualspeed, 0, map);
                                        }
                                    }
                                }

                            }
                        }
                        else if (kistate == 1)
                        {
                            //KI befindet sich im Drüberspringmodus bei Abgründen!!
                            //Gucke ob er Grund haben könnte
                            if (CollisionCheckedVector(0, (int)((gravitation)), map.blocks).Y == (int)((gravitation)))
                            {
                                if (fall)
                                {
                                    for (int i = 0; i < 10; i++)
                                    {
                                        kicollide.Y = cbox.box.Y + i * gravitation;
                                        foreach (Block block in map.blocks)
                                        {
                                            if (kicollide.Intersects(block.cbox) && block.block)
                                            {
                                                geht = true;
                                                break;
                                            }

                                        }
                                    }
                                }
                                //Kein Grund T_T Beweg mich mal
                                for (int i = 0; i < 10; i++)
                                {
                                    kicollide.Y = cbox.box.Y + i * gravitation;
                                    if (kicollide.Intersects(spieler))
                                        geht = true;
                                }
                                if (!geht)
                                    Move(actualspeed, 0, map);
                            }
                            else
                            {
                                jumptimer = 0;
                                if (CollisionCheckedVector(0, 1, map.blocks).Y == 0)
                                {
                                    //Grund!!!! Wir sind unten!!! Starte normalen Modus
                                    kistate = 0;
                                }
                            }
                        }
                        else if (kistate == 2)
                        {
                            if (jump)
                            {
                                for (int i = 0; i < 10; i++)
                                {
                                    kicollide.Y = cbox.box.Y + i * gravitation;
                                    if (kicollide.Intersects(spieler))
                                        geht = true;
                                }
                            }
                            if (!geht)
                                Move(actualspeed, 0, map);
                            //KI befindet sich im Drüberspringmodus!!
                            //Es scheint etwas rechts gegeben zu haben wo er drüberspringen muss
                            //Überprüfe ob rechts immernoch etwas ist
                            if (CollisionCheckedVector(0, 1, map.blocks).Y == 0)
                            {
                                jumptimer = 0;
                                kistate = 0;
                            }
                        }

                        else if (kistate == 3)
                        {
                            //KI befindet sich im Drüberspringmodus!!
                            //Es scheint etwas rechts gegeben zu haben wo er drüberspringen muss
                            //Überprüfe ob rechts immernoch etwas ist
                            if (CollisionCheckedVector(actualspeed, 0, map.blocks).X == actualspeed)
                            {
                                //Rechts ist nichts mehr! Kann mit dem Springen aufhören und sich draufbewegen
                                Move(actualspeed, 0, map);
                                jumptimer = 0;
                                kistate = 0;
                            }
                        }

                        else if (kistate == 4)
                        {
                            spine.anim("idle", 3, true);
                            //KI befindet sich im Wartemodus!!
                            //Überprüfe ob die Plattform bald da ist
                            bool bewegblock = false;
                            kicollide.X = cbox.box.X + 64;
                            kicollide.Y = cbox.box.Y + 1;
                            foreach (MovingBlock mblock in map.mblocks)
                            {
                                if (kicollide.Intersects(mblock.cbox))
                                {
                                    bewegblock = true;
                                    //TATSACHE!! Er ist da!!
                                }
                            }
                            if (bewegblock)
                            {
                                if (Math.Abs(spielerdistanz) < 240)
                                    Sound.Play("ashbrett_jumping");
                                spine.anim("jump", 3, false);
                                Move(actualspeed, 0, map);
                                Jump(gameTime, map); //Springen!
                                kistate = 5;
                            }
                        }
                        else if (kistate == 5)
                        {
                            //Er springt auf die Plattform! YEA
                            float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                            if (CollisionCheckedVector(0, (int)((gravitation * t)), map.blocks).Y == (int)((gravitation * t)))
                            {
                                //Kein Grund T_T Beweg mich mal
                                Move(actualspeed, 0, map);
                            }
                            else
                            {
                                jumptimer = 0;
                                if (CollisionCheckedVector(0, 1, map.blocks).Y == 0)
                                {
                                    //Grund!!!! Wir sind unten!!! Starte nächsten Modus
                                    kistate = 6;
                                }
                            }
                        }
                        else if (kistate == 6)
                        {
                            //Befindet sich auf der Plattform
                            //Beweg mich mal nach Forme und schau ob ich da falle T_T
                            spine.anim("walk", 3, true);
                            Move(actualspeed, 0, map);
                            if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                            {
                                //Ah wir fallen! Schnell zurück!
                                Move(-actualspeed, 0, map);
                                kistate = 7;
                            }
                        }
                        else if (kistate == 7)
                        {
                            //Ki Wartet nun am Ende und wartet auf einen movingend
                            spine.anim("idle", 3, true);
                            bool bewegblock = false;
                            kicollide.X = cbox.box.X + 48;
                            kicollide.Y = cbox.box.Y + 1;
                            foreach (Block block in map.blocks)
                            {
                                if (kicollide.Intersects(block.cbox) && block.type == "movingend")
                                {
                                    bewegblock = true;
                                    //TATSACHE!! Er ist da!!
                                }
                            }
                            if (bewegblock)
                            {
                                if (Math.Abs(spielerdistanz) < 240)
                                    Sound.Play("ashbrett_jumping");
                                spine.anim("jump", 3, false);
                                Jump(gameTime, map); //Springen!
                                kistate = 8;
                            }
                        }
                        else if (kistate == 8)
                        {
                            //Er springt auf die Plattform! YEA
                            float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                            if (CollisionCheckedVector(0, (int)((gravitation * t)), map.blocks).Y == (int)((gravitation * t)))
                            {
                                //Kein Grund T_T Beweg mich mal
                                Move(actualspeed, 0, map);
                            }
                            else
                            {
                                if (CollisionCheckedVector(actualspeed+96, 0, map.blocks).X == actualspeed+96)
                                {
                                    jumptimer = 0;
                                    if (CollisionCheckedVector(0, 1, map.blocks).Y == 0)
                                    {
                                        //Grund!!!! Wir sind unten!!! Starte nächsten Modus
                                        kistate = 0;
                                    }
                                }
                            }
                        }
                        else if (kistate == 9)
                        {
                            if (CollisionCheckedVector(0, 1, map.blocks).Y == 0)
                            {
                                //Grund!!!! Wir sind unten!!! Starte normalen Modus
                                kistate = 0;
                            }
                        }
                    }
                }
                if (CollisionCheckedVector(0, 1, map.blocks).Y > 0 && !jump)
                {
                    if (!fall)
                    {
                        fall = true;
                        falltimer = Game1.time.TotalMilliseconds;
                    }
                    float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                    Move(0, (int)((gravitation * t)), map); //v(t)=-g*t
                }
                else
                {
                    fall = false;
                }

                //Sprung fortführen
                if (jump)
                {
                    Jump(gameTime, map);
                }
                if (position.Y > map.size.Y) Reset();
                foreach (MovingBlock block in map.mblocks)
                {
                    Rectangle collide = new Rectangle(cbox.box.X, cbox.box.Y + 1, cbox.box.Width, cbox.box.Height);
                    //Wenn Kollision vorliegt: Keinen weiteren Block abfragen
                    int movespeed = Convert.ToInt32((double)Game1.luaInstance["blockSpeed"]);
                    if (block.move == 2)
                        movespeed = -movespeed;
                    if (collide.Intersects(block.cbox))
                    {
                        if (GameScreen.slow != 0)
                        {
                            movespeed = movespeed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
                        }
                        Move(movespeed, 0, map);
                        break;
                    }

                    collide.Y = cbox.box.Y;
                    collide.X = cbox.box.X - movespeed;
                    if (collide.Intersects(block.cbox))
                    {
                        if (CollisionCheckedVector(movespeed, 0, map.blocks).X == movespeed)
                        {
                            Move(movespeed, 0, map);
                            break;
                        }
                        else
                        {
                            if (block.move == 1)
                                block.move = 2;
                            else
                                block.move = 1;
                            break;
                        }
                    }
                }
            }
            else
            {
                herotime += gameTime.ElapsedGameTime.TotalSeconds;
                if (herotime > heroStartTime)
                    start = true;
            }
        }
 public Vector2 CollisionCheckedVector(int x, int y, List<Block> list, Map map)
 {
     CollisionBox cboxnew = new CollisionBox((int)cbox.offset.X, (int)cbox.offset.Y, cbox.box.Width, cbox.box.Height);
     cboxnew.Update(cbox.position);
     Vector2 move = new Vector2(0, 0);
     int icoll;
     bool stop;
     //Größere Koordinate als Iteration nehmen
     if (Math.Abs(x) > Math.Abs(y))
     {
         icoll = Math.Abs(x);
     }
     else
     {
         icoll = Math.Abs(y);
     }
     //Iteration
     for (int i = 1; i <= icoll; i++)
     {
         stop = false;
         //Box für nächsten Iterationsschritt berechnen
         cboxnew.box.X = this.cbox.box.X + ((x / icoll) * i);
         cboxnew.box.Y = this.cbox.box.Y + ((y / icoll) * i);
         //Gehe die Blöcke der Liste durch
         foreach (Block block in list)
         {
             //Wenn Kollision vorliegt: Keinen weiteren Block abfragen
             if ((cboxnew.box.Intersects(block.cbox) && block.block) || cboxnew.box.X < 0 || (cboxnew.box.X + cboxnew.box.Width) > map.size.X || cboxnew.box.Y <= 0)
             {
                 stop = true;
                 break;
             }
         }
         if (stop == true) //Bei Kollision: Kollisionsabfrage mit letztem kollisionsfreien Zustand beenden
         {
             break;
         }
         else //Kollisionsfreien Fortschritt speichern
         {
             move.X = cboxnew.box.X - cbox.box.X;
             move.Y = cboxnew.box.Y - cbox.box.Y;
         }
     }
     return move;
 }
        public void Update(GameTime gameTime, Map map, Princess princess)
        {
            speed = Convert.ToInt32((double)Game1.luaInstance["playerSpeed"]);
            airspeed = Convert.ToInt32((double)Game1.luaInstance["playerAirspeed"]);
            jumppower = Convert.ToInt32((double)Game1.luaInstance["playerJumppower"]);
            gravitation = Convert.ToInt32((double)Game1.luaInstance["playerGravitation"]);

            //Geschwindigkeit festlegen
            int actualspeed = speed;
            if (jump || fall)
            {
                actualspeed = airspeed;
            }
            //Einfluss Gamepad
            if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X != 0)
            {
                actualspeed = (int)((float)actualspeed * Math.Abs(GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X));
            }
            //Einfluss princess.beating
            if (princess.beating)
            {
                actualspeed = actualspeed / 2;
                float randomAcceleration = (float)randomNumber.Next(-50, 50) / 80;
                acceleration += initAcceleration * randomAcceleration;
                if (acceleration < -initAcceleration)
                {
                    acceleration = -initAcceleration;
                }
                if (acceleration > initAcceleration)
                {
                    acceleration = initAcceleration;
                }
            }
            //-----Sprung-----
            if ((Game1.input.sprung || savejump) && !princess.beating)
            {
                if (!jump && !fall && Game1.input.sprungp)
                {
                    Sound.Play("bonepuker_jump");
                    spine.animationTimer = Game1.time.TotalMilliseconds;
                    spine.animationState.SetAnimation(0, "jump", false);
                    spine.animation = "jump";
                    //spine.Clear(0);
                    //spine.anim("jump", 0, false, gameTime);
                    Jump(gameTime, map); //Springen!
                    savejump = false;
                }
                else if (fall)
                {
                    savejump = true;
                }
                else
                {
                    savejump = false;
                }
            }
            else
            {
                if (jump && !Game1.input.sprungp)
                {
                    jumptimer -= GameScreen.slow + Convert.ToInt32((double)Game1.luaInstance["playerJumpCutoff"]);
                }
            }
            //-----Schlag / Smash starten-----
            if (Game1.input.smash && !princess.beating && (jump || fall))
            {
                if (gameTime.TotalGameTime.TotalMilliseconds > (smashTimer + smashCooldown)) //Smash beginnen
                {
                    if (Game1.time.TotalMilliseconds > (smashTimer + smashCooldown)) //Smash beginnen
                    {
                        Sound.Play("bonepuker_smash");
                        jump = false;
                        fall = true;
                        hit = false;
                        smash = true;
                        spine.anim("smash", 0, false);
                        smashTimer = Game1.time.TotalMilliseconds;
                        smashIntensity = smashInitIntensity;
                        falltimer = Game1.time.TotalMilliseconds - Convert.ToInt32((double)Game1.luaInstance["playerMegaSchlagFall"]);
                    }
                }
            }
            else if (Game1.input.hit && !princess.beating)
            {
                if (!smash && (!hit || Game1.time.TotalMilliseconds > hitTimer + (spine.skeleton.Data.FindAnimation("attack").Duration * 1000) * 0.4)) //Schlag beginnen
                {
                    Sound.Play("bonepuker_attack");
                    Sound.Play("schlag");
                    hit = true;
                    spine.anim("attack", 0, false);
                    hitTimer = Game1.time.TotalMilliseconds;
                }
            }
            //Schlag ggf beenden
            if (hit && Game1.time.TotalMilliseconds > hitTimer + (spine.skeleton.Data.FindAnimation("attack").Duration * 1000))
            {
                hit = false;
                spine.animationState.ClearTrack(1);
            }
            //Smash fortführen
            if (smash)
            {
                smashIntensity--;
                //Smash ggf beenden
                if (smashIntensity <= 0)
                {
                    smash = false;
                    smashImpact = false;
                }
                else if (CollisionCheckedVector(0, 1, map.blocks, map).Y == 0)
                {
                    smashImpact = true;
                }
            }
            if (!smash)
            {
                //-----Move-----
                if (Game1.input.rechts) //Wenn Rechte Pfeiltaste
                {
                    richtung = true;
                    acceleration += 1 / (60 * initAcceleration);
                    if (Math.Abs(acceleration) <= 2 / (60 * initAcceleration) || Math.Abs(acceleration) > initAcceleration) //Drehen bzw weiter laufen
                    {
                        if (!jump && !fall)
                        {
                            spine.anim("run", 2, true);
                        }
                        else
                        {
                            spine.anim("jump", 2, false);
                        }
                    }
                    else if (spine.flipSkel && Math.Abs(acceleration) <= 2 / (60 * initAcceleration)) //Bei direktem Richtungstastenwechsel trotzdem beim Abbremsen in idle übergehen
                    {
                        if (!jump && !fall)
                        {
                            spine.anim("idle", 0, true); //In idle-Position übergehen
                        }
                    }
                    if (jump || fall) //Zusätzliche Beschleunigung in der Luft
                    {
                        acceleration += 2 / (60 * initAcceleration);
                    }
                }
                else if (Game1.input.links) //Wenn Rechte Pfeiltaste
                {
                    richtung = false;
                    acceleration -= 1 / (60 * initAcceleration);
                    if (Math.Abs(acceleration) <= 2 / (60 * initAcceleration) || Math.Abs(acceleration) > initAcceleration) //Drehen bzw weiter laufen
                    {
                        if (!jump && !fall)
                        {
                            spine.anim("run", 1, true);
                        }
                        else
                        {
                            spine.anim("jump", 1, false);
                        }
                    }
                    else if (!spine.flipSkel && Math.Abs(acceleration) <= 2 / (60 * initAcceleration)) //Bei direktem Richtungstastenwechsel trotzdem in idle übergehen
                    {
                        if (!jump && !fall)
                        {
                            spine.anim("idle", 0, true); //In idle-Position übergehen
                        }
                    }
                    if (jump || fall) //Zusätzliche Beschleunigung in der Luft
                    {
                        acceleration -= 2 / (60 * initAcceleration);
                    }
                }
                else
                {
                    //Auslaufen_Abbremsen
                    if (acceleration < 0)
                    {
                        acceleration += 1 / (60 * initAcceleration);
                        if (acceleration > 0) //Nicht umdrehen
                        {
                            acceleration = 0;
                        }
                    }
                    else if (acceleration > 0)
                    {
                        acceleration -= 1 / (60 * initAcceleration);
                        if (acceleration < 0) //Nicht umdrehen
                        {
                            acceleration = 0;
                        }
                    }
                    if (!jump && !fall)
                    {
                        spine.anim("idle", 0, true); //In idle-Position übergehen
                    }
                }
                //Keine Beschleunigungs"vermehrung", durch Beschleunigung wird nur MaxSpeed bei jedem Update absolut vermindert. Fake aber funzt...
                if (acceleration < -initAcceleration)
                {
                    acceleration = -initAcceleration;
                }
                if (acceleration > initAcceleration)
                {
                    acceleration = initAcceleration;
                }
                if (Math.Abs(CollisionCheckedVector((int)((acceleration / initAcceleration) * actualspeed), 0, map.blocks, map).X) < Math.Abs((int)((acceleration / initAcceleration) * actualspeed)))
                {
                    acceleration = -acceleration * 0.8f;
                }
                Move((int)((acceleration / initAcceleration) * actualspeed), 0, map);
                if (Game1.input.itemu1)
                {
                    if (item1 == 1)
                    {
                        Sound.Play("time_shift");
                        GameScreen.slow = GameScreen.slow + Convert.ToInt32((double)Game1.luaInstance["itemSlowTime"]);
                        item1 = 0;
                    }
                    else if (item1 == 2 && !fall && !jump)
                    {
                        map.objects.Add(new Banana(new Vector2(cbox.box.X, cbox.box.Y + cbox.box.Height - 96), 1));
                        item1 = 0;
                    }
                    else if (item1 == 3 && !fall && !jump)
                    {
                        Sound.Play("skullmonkey_item");
                        map.enemies.Add(new Monkey(new Vector2(cbox.box.X, cbox.box.Y + cbox.box.Height - 64), 2, false));
                        item1 = 0;
                    }
                }
                if (Game1.input.itemu2)
                {
                    if (item2 == 1)
                    {
                        Sound.Play("time_shift");
                        GameScreen.slow = GameScreen.slow + Convert.ToInt32((double)Game1.luaInstance["itemSlowTime"]);
                        item2 = 0;
                    }
                    else if (item2 == 2 && !fall && !jump)
                    {
                        map.objects.Add(new Banana(new Vector2(cbox.box.X, cbox.box.Y + cbox.box.Height - 48), 1));
                        item2 = 0;
                    }
                    else if (item2 == 3 && !fall && !jump)
                    {
                        Sound.Play("skullmonkey_item");
                        map.enemies.Add(new Monkey(new Vector2(cbox.box.X, cbox.box.Y + cbox.box.Height - 64), 2, false));
                        item2 = 0;
                    }
                }
            }

            //Gravitation
            if (CollisionCheckedVector(0, 1, map.blocks, map).Y > 0 && !jump)
            {
                if (!fall)
                {
                    fall = true;
                    falltimer = Game1.time.TotalMilliseconds;
                }
                float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                Move(0, (int)((gravitation * t)), map); //v(t)=-g*t
                if(!smash)
                    spine.anim("jump", 0, false);
            }
            else
            {
                if (fall)
                {
                    fall = false;
                    Sound.Play("land");
                }
            }

            //Sprung fortführen
            if (jump)
            {
                Jump(gameTime, map);
            }
            foreach (MovingBlock block in map.mblocks)
            {
                Rectangle collide = new Rectangle(cbox.box.X, cbox.box.Y + 1, cbox.box.Width, cbox.box.Height);
                //Wenn Kollision vorliegt: Keinen weiteren Block abfragen
                int movespeed = Convert.ToInt32((double)Game1.luaInstance["blockSpeed"]);
                if (block.move == 2)
                    movespeed = -movespeed;
                if (collide.Intersects(block.cbox))
                {
                    if (GameScreen.slow != 0)
                    {
                        movespeed = movespeed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
                    }
                    Move(movespeed, 0, map);
                    break;
                }

                collide.Y = cbox.box.Y;
                collide.X = cbox.box.X - movespeed;
                if (collide.Intersects(block.cbox))
                {
                    if (CollisionCheckedVector(movespeed, 0, map.blocks, map).X == movespeed)
                    {
                        Move(movespeed, 0, map);
                        break;
                    }
                    else
                    {
                        if (block.move == 1)
                            block.move = 2;
                        else
                            block.move = 1;
                        break;
                    }
                }
            }
            position.Y = spine.skeleton.Y;
            position.X = spine.skeleton.X;
            if (jump || fall) //SchlagStaub ggf hiden
            {
                //StaubSkinAttachment hiden
            }
        }
Ejemplo n.º 17
0
 public virtual void Update(GameTime gameTime, Map map)
 {
 }
 public void Update(GameTime gameTime, Player player, Map map)
 {
     spine.skeleton.X = player.position.X;
     spine.skeleton.Y = player.position.Y;
     if (bag)
     {
         ResetRage(gameTime);
     }
     else if (!beating && !coverEyes)
     {
         player.spine.animationState.ClearTrack(2);
     }
     if (beating)
     {
         if (Game1.time.TotalMilliseconds > beatingTimer + (spine.skeleton.Data.FindAnimation("cloud").Duration * 1000)) //Kloppwolke zu Ende?
         {
             beating = false;
             rageMode = false;
             player.spine.Clear(2);
             rageMeter = 0;
             rageTimer = Game1.time.TotalMilliseconds;
             //spine.animationState.ClearTrack(0);
         }
     }
     else if (coverEyes)
     {
         if (Game1.time.TotalMilliseconds > (coverTimer + (float)coverTime)) //CoverEyes beenden?
         {
             coverEyes = false;
             rageMode = false;
             player.spine.Clear(2);
             rageMeter = 0;
             rageTimer = Game1.time.TotalMilliseconds;
         }
     }
     if (rageMode)
     {
         rageMeter += 100 / ((float)enrageSpeed * 60); //RageUp
         if (Game1.input.rechts)
         {
             if (pressedLeft)
             {
                 rageMeter -= unrageSpeed; //RageDown
                 pressedLeft = false;
             }
         }
         else if (Game1.input.links)
         {
             if (!pressedLeft)
             {
             rageMeter -= unrageSpeed; //RageDown
             pressedLeft = true;
             }
         }
         if (rageMeter > rageLimit && !coverEyes && !beating) //Enrage?!?
         {
             if (!player.fall && !player.jump)
             {
                 player.spine.Clear(2);
                 randomNumber = randomGen.Next(0, 100); //Augen zu halten vs hart aufs Maul!
                 if (randomNumber <= 50)
                 {
                     beating = true;
                     beatingTimer = Game1.time.TotalMilliseconds;
                     int tempFlipState;
                     if (spine.skeleton.FlipX)
                     {
                         tempFlipState = 1;
                     }
                     else
                     {
                         tempFlipState = 2;
                     }
                     spine.anim("cloud", tempFlipState, false);
                     //ENRAAAAAGGGGEEEE!!!!!!!!!!!!!!!!!
                 }
                 else
                 {
                     coverEyes = true;
                     player.spine.anim("sc_cover_eyes", 0, true);
                     coverTimer = Game1.time.TotalMilliseconds;
                     //Deine Mudda enraged!
                 }
             }
         }
         if (rageMeter <= 0)
         {
             Sound.Stop("sweetcheeks_enrage");
             rageMode = false;
             player.spine.Clear(2);
             rageMeter = 0;
         }
     }
     else if (Game1.time.TotalMilliseconds > (rageTimer + (float)rageWarmup)) //RageWarmup
     {
         if (player.CollisionCheckedVector(0, 1, map.blocks, map).X == 0) //Nur auf dem Boden enragen
         {
             rageTimer = Game1.time.TotalMilliseconds;
             randomNumber = randomGen.Next(0, 100);
             if (randomNumber <= rageChance)
             {
                 //Teste Enrage-Bedingungen
                 Sound.Play("sweetcheeks_enrage");
                 rageMode = true;
                 player.spine.anim("sc_escape", 0, true);
             }
         }
         else
         {
             rageTimer = Game1.time.TotalMilliseconds - ((float)rageWarmup * 0.2f); //Wenn Spieler wieder auf den Boden kommt nach kurzer Zeit enragen
         }
     }
 }
        public virtual void Update(GraphicsDeviceManager graphics, Player spieler, Map karte)
        {
            //Kamera an Spieler anpassen 
            int leftspace = Convert.ToInt32((double)Game1.luaInstance["cameraLeftspace"]);
            int rightspace = Convert.ToInt32((double)Game1.luaInstance["cameraRightspace"]);
            int bottomspace = Convert.ToInt32((double)Game1.luaInstance["cameraBottomspace"]);
            int topspace = Convert.ToInt32((double)Game1.luaInstance["cameraTopspace"]);
            int maxbewegung = Convert.ToInt32((double)Game1.luaInstance["cameraMaxBewegung"]);
            int bewegungsteps = Convert.ToInt32((double)Game1.luaInstance["cameraBewegungSteps"]);
            if (Game1.input.camR)
            {
                if (camerabewegung < maxbewegung)
                    camerabewegung += bewegungsteps;
            }
            else if (Game1.input.camL)
            {
                if (camerabewegung > -maxbewegung)
                    camerabewegung -= bewegungsteps;
            }
            else if(camerabewegung != 0)
            {
                if (camerabewegung > 0)
                    camerabewegung -= bewegungsteps;
                else
                    camerabewegung += bewegungsteps;

            }

            if (viewport.X + leftspace > spieler.position.X) //Scrolling nach links
            {
                viewport.X = (int)spieler.position.X - leftspace;
            }
            else if (viewport.X + viewport.Width - rightspace < spieler.position.X) //Scrolling nach rechts
            {
                viewport.X = (int)spieler.position.X - (viewport.Width - rightspace);
            }
            if (viewport.X < 0) //Linker Maprand
            {
                viewport.X = 0;
            }
            else if (viewport.X > karte.size.X - viewport.Width) //Rechter Maprand
            {
                viewport.X = (int)karte.size.X - viewport.Width;
            }
            if (viewport.X + camerabewegung > 0 && viewport.X + camerabewegung < karte.size.X - viewport.Width)
                viewport.X += camerabewegung;
            else if (viewport.X + camerabewegung > karte.size.X-viewport.Width) //Rechter Maprand
                viewport.X = (int)karte.size.X - viewport.Width;
            else if(viewport.X + camerabewegung < 0)
                viewport.X = 0;
            if (viewport.Y + topspace > spieler.position.Y) //Scrolling nach oben
            {
                viewport.Y = (int)spieler.position.Y - topspace;
            }
            else if (viewport.Y + viewport.Height - bottomspace < spieler.position.Y) //Scrolling nach unten
            {
                viewport.Y = (int)spieler.position.Y - (viewport.Height - bottomspace);
            }
            if (viewport.Y < 0) //Oberer Maprand
            {
                viewport.Y = 0;
            }
            else if (viewport.Y > karte.size.Y - viewport.Height) //Unterer Maprand
            {
                viewport.Y = (int)karte.size.Y - viewport.Height;
            }
            UpdateTransformation(graphics); //Abgekapselt damit Camera für Menü ohne Spieler verwendbar ist.
        }
Ejemplo n.º 20
0
        public void Update(GameTime gameTime, Map map, Rectangle spieler,bool sirenscream)
        {
            Rectangle Player = spieler;
            //Welle Laden Start
            if (waveCooldown > 0)
                waveCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds/1000;
            else if (!emittingWaves && cbox.box.Y >= spieler.Y && cbox.box.Y - 48 <= spieler.Y + spieler.Height&&!fall&&!jump&&animeTime <= 0)
            {
                hits = false;
                if (spieler.X < position.X)
                {
                    notFlipped = false;
                    spine.anim("super_attack", 2, false);
                }
                else
                {
                    notFlipped = true;
                    spine.anim("super_attack", 1, false);
                }
                waveRichtung = notFlipped;
                schlagbar = false;
                wavestart = true;
                animeTime = 1.2;
                attacktimer = 0;
            }

            speed = Convert.ToInt32((double)Game1.luaInstance["heroSpeed"]);
            int realspeed = Convert.ToInt32((double)Game1.luaInstance["heroKISpeed"]);
            if (GameScreen.slow != 0)
            {
                speed = speed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
            }
            if (slowtime != 0)
            {
                speed = speed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
            }
            if (sirenscream)
            {
                speed = speed / 2;
            }
            airspeed = Convert.ToInt32((double)Game1.luaInstance["heroAirspeed"]);
            jumppower = Convert.ToInt32((double)Game1.luaInstance["heroJumppower"]);
            gravitation = Convert.ToInt32((double)Game1.luaInstance["heroGravitation"]);
            //Geschwindigkeit festlegen
            int actualspeed = speed;
            if (jump || fall)
            {
                actualspeed = airspeed;
            }
            int sx = spieler.X;
            int px = cbox.box.X;
            if (sx < px)
            {
                sx += spieler.Width;
            }
            else
            {
                px += cbox.box.Width;
            }
            float spielerdistanz = sx - px;
            bool isspieler = true;
            kicollide = cbox.box;
            if (Math.Abs(spielerdistanz) < 120 && cbox.box.Y >= spieler.Y && cbox.box.Y - 480 <= spieler.Y + spieler.Height && !jump && !fall)
            {
                bool geht = true;
                for (int i = 0; i < 10; i++)
                {
                    kicollide.Y = cbox.box.Y - i * 48;
                    foreach (Block block in map.blocks)
                    {
                        if (kicollide.Intersects(block.cbox) && block.block)
                        {
                            geht = false;
                            break;
                        }

                    }
                }
                if (geht)
                {
                    kistate = 0;
                }
                else
                {
                    if (kicheck.Count() != 0)
                    {
                        foreach (KIPoint kipoint in map.kipoints)
                        {
                            if (kipoint.id == kicheck.ElementAt(0).id)
                            {
                                spieler = kipoint.cbox;
                                isspieler = false;
                            }
                        }
                    }
                }
            }
            else
            {
                if (kicheck.Count() != 0)
                {
                    foreach (KIPoint kipoint in map.kipoints)
                    {
                        if (kipoint.id == kicheck.ElementAt(0).id)
                        {
                            spieler = kipoint.cbox;
                            isspieler = false;
                        }
                    }
                }
            }
            float punktdistanz = spieler.X - position.X;
            //sposition.X = map.size.X;
            //Vector2 Punkt = map.kipoints.ElementAt(kipoint).position;
            // sposition.X = Punkt.X;
            if (attacktimer > 0)
            {
                attacktimer -= gameTime.ElapsedGameTime.TotalMilliseconds / 1000;
                if(attacktimer < 0.5&&attacktimer > 0)
                    hits = true;
                else if (attacktimer <= 0)
                {
                    hits = false;
                    animeTime = 0.3f;
                    spine.anim("idle", 3, true);
                    schlagbar = true;
                }

            }
            else if (animeTime > 0)
            {
                if (wavestart)
                    Console.WriteLine(animeTime + " a:" + gameTime.ElapsedGameTime.TotalMilliseconds / 1000);
                animeTime -= gameTime.ElapsedGameTime.TotalMilliseconds / 1000;

            }
            else if (wavestart)
            {
                if (waveRichtung)
                    spine.anim("", 1, false);
                else
                    spine.anim("", 2, false);
                Sound.Play("ashbrett_superattack");
                wavestart = false;
                emittingWaves = true;
                waveCooldown = 8;
            }
            else if (emittingWaves)
            {
            }
            else if (screamhit)
            {
                Console.WriteLine("A");
                schlagbar = false;
                //Wenn Spieler ist hinten bewege zurück
                if (spieler.X < position.X)
                {
                    spine.anim("", 2, false);
                    notFlipped = false;
                    actualspeed = -actualspeed;
                    realspeed = -realspeed;
                }
                else
                {
                    spine.anim("", 1, false);
                    notFlipped = true;
                }
                if (sirenscream)
                {
                    actualspeed = -actualspeed;
                    realspeed = -realspeed;
                    if (notFlipped)
                    {
                        notFlipped = false;
                    }
                    else
                    {
                        notFlipped = true;
                    }
                }
                if (!cbox.box.Intersects(spieler))
                {
                    GameScreen.test = 0;
                    bool geht = false;
                    kicollide = cbox.box;
                    if (kistate == 0)
                    {
                        if (Math.Abs(spielerdistanz) < Convert.ToInt32((double)Game1.luaInstance["heroCloseWalkRange"]))
                        {
                            if (actualspeed > 0)
                                spine.anim("close", 1, true);
                            else
                                spine.anim("close", 2, true);
                        }
                        else
                        {
                            if (actualspeed > 0)
                                spine.anim("walk", 1, true);
                            else
                                spine.anim("walk", 2, true);
                        }
                        //KI ist auf den Boden und alles ist gut
                        //Schaue ob der Block rechts ist
                        if (kicheck.Count() != 0)
                        {
                            for (int i = 0; i < 50; i++)
                            {
                                kicollide.X = cbox.box.X + i * realspeed;
                                kicollide.Y = cbox.box.Y;
                                foreach (KIPoint kipoint in map.kipoints)
                                {
                                    if (kicollide.Intersects(kipoint.cbox) && kipoint.id == kicheck.ElementAt(0).id)
                                    {
                                        geht = true;
                                        break;
                                    }
                                }
                                if (geht)
                                    break;
                            }
                        }
                        //Block ist auf gleicher Höhe, bewege nur drauf zu
                        if (geht)
                        {
                            if (CollisionCheckedVector(actualspeed, 0, map.blocks, Player).X == actualspeed)
                            {
                                if (Math.Abs(spielerdistanz) > actualspeed * 2)
                                {
                                    Move(actualspeed, 0, map);
                                }
                            }
                            else if (Math.Abs(spielerdistanz) - 20 > Math.Abs(actualspeed))
                            {
                                if (!fall && !jump)
                                {
                                    Sound.Play("ashbrett_jumping");
                                    spine.anim("jump", 3, false);
                                    Jump(gameTime, map); //Springen!
                                    kistate = 3;
                                }

                            }
                            if (kistate == 0 && CollisionCheckedVector(0, 1, map.blocks, Player).Y > 0)
                            {
                                //AAAAHHH WIR fallen T_T
                                if (!fall && !jump)
                                {
                                    Sound.Play("ashbrett_jumping");
                                    Jump(gameTime, map); //Springen!
                                    kistate = 1;
                                }
                                else
                                {
                                    Move(-actualspeed, 0, map);
                                }

                            }
                        }
                        else
                        {
                            if (spieler.Y < position.Y - 20 && !isspieler)
                            {
                                if (CollisionCheckedVector(realspeed, 0, map.blocks, Player).X == realspeed)
                                {
                                    kicollide.X = cbox.box.X;
                                    kicollide.Y += 1;
                                    //Block ist über den Hero
                                    bool b = false;
                                    int deltay = 0;
                                    Rectangle kicollide2 = cbox.box;
                                    for (int i = 0; i < 60; i++)
                                    {
                                        float t = (float)(i / 22);
                                        deltay = deltay + (int)(-jumppower + (gravitation * t));
                                        kicollide.X = cbox.box.X + (i * realspeed);
                                        kicollide.Y = cbox.box.Y + deltay;
                                        kicollide2.X = cbox.box.X + (i * realspeed);
                                        if (kicollide.Intersects(spieler) && !kicollide2.Intersects(spieler))
                                        {
                                            b = true;
                                            break;
                                        }
                                    }
                                    if (b)
                                    {
                                        if (!fall && !jump)
                                        {
                                            Sound.Play("ashbrett_jumping");
                                            spine.anim("jump", 3, false);
                                            Jump(gameTime, map); //Springen!
                                            kistate = 2;
                                        }
                                        else
                                        {
                                            Move(-actualspeed, 0, map);
                                        }
                                    }
                                    else
                                    {
                                        Move(actualspeed, 0, map);
                                        if (CollisionCheckedVector(0, 1, map.blocks, Player).Y > 0)
                                        {
                                            Move(-actualspeed, 0, map);
                                            if (!fall && !jump)
                                            {
                                                Sound.Play("ashbrett_jumping");
                                                spine.anim("jump", 3, false);
                                                Jump(gameTime, map); //Springen!
                                                kistate = 2;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (!fall && !jump)
                                    {
                                        Sound.Play("ashbrett_jumping");
                                        spine.anim("jump", 3, false);
                                        Jump(gameTime, map); //Springen!
                                        kistate = 3;
                                    }

                                }
                            }
                            else
                            {
                                if (CollisionCheckedVector(0, 1, map.blocks, Player).Y > 0)
                                {
                                    for (int i = 0; i < 10; i++)
                                    {
                                        kicollide.X = cbox.box.X;
                                        kicollide.Y = cbox.box.Y + i * gravitation;
                                        if (kicollide.Intersects(spieler))
                                            geht = true;
                                    }
                                }
                                if (!geht)
                                {
                                    if (Math.Abs(spielerdistanz) > actualspeed * 2)
                                    {
                                        Console.WriteLine(spielerdistanz + " " + actualspeed);
                                        Move(actualspeed, 0, map);
                                    }
                                }
                            }
                        }
                    }
                    else if (kistate == 1)
                    {
                        //KI befindet sich im Drüberspringmodus bei Abgründen!!
                        //Gucke ob er Grund haben könnte
                        if (CollisionCheckedVector(0, (int)((gravitation)), map.blocks, Player).Y == (int)((gravitation)))
                        {
                            if (fall)
                            {
                                for (int i = 0; i < 10; i++)
                                {
                                    kicollide.Y = cbox.box.Y + i * gravitation;
                                    foreach (Block block in map.blocks)
                                    {
                                        if (kicollide.Intersects(block.cbox) && block.block)
                                        {
                                            geht = true;
                                            break;
                                        }

                                    }
                                }
                            }
                            //Kein Grund T_T Beweg mich mal
                            for (int i = 0; i < 10; i++)
                            {
                                kicollide.Y = cbox.box.Y + i * gravitation;
                                if (kicollide.Intersects(spieler))
                                    geht = true;
                            }
                            if (!geht)
                                Move(actualspeed, 0, map);
                        }
                        else
                        {
                            jumptimer = 0;
                            if (CollisionCheckedVector(0, 1, map.blocks, Player).Y == 0)
                            {
                                //Grund!!!! Wir sind unten!!! Starte normalen Modus
                                kistate = 0;
                            }
                        }
                    }
                    else if (kistate == 2)
                    {
                        if (jump)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                kicollide.Y = cbox.box.Y + i * gravitation;
                                if (kicollide.Intersects(spieler))
                                    geht = true;
                            }
                        }
                        if (!geht)
                            Move(actualspeed, 0, map);
                        //KI befindet sich im Drüberspringmodus!!
                        //Es scheint etwas rechts gegeben zu haben wo er drüberspringen muss
                        //Überprüfe ob rechts immernoch etwas ist
                        if (CollisionCheckedVector(0, 1, map.blocks, Player).Y == 0)
                        {
                            jumptimer = 0;
                            kistate = 0;
                        }
                    }

                    else if (kistate == 3)
                    {
                        //KI befindet sich im Drüberspringmodus!!
                        //Es scheint etwas rechts gegeben zu haben wo er drüberspringen muss
                        //Überprüfe ob rechts immernoch etwas ist
                        if (CollisionCheckedVector(actualspeed, 0, map.blocks, Player).X == actualspeed)
                        {
                            //Rechts ist nichts mehr! Kann mit dem Springen aufhören und sich draufbewegen
                            Move(actualspeed, 0, map);
                            jumptimer = 0;
                            kistate = 0;
                        }
                    }
                    else if (kistate == 4)
                    {
                        if (CollisionCheckedVector(0, 1, map.blocks, Player).Y == 0)
                        {
                            //Grund!!!! Wir sind unten!!! Starte normalen Modus
                            kistate = 0;
                        }
                    }
                }
            }
            if (CollisionCheckedVector(0, 1, map.blocks, Player).Y > 0 && !jump)
            {
                if (!fall)
                {
                    fall = true;
                    falltimer = Game1.time.TotalMilliseconds;
                }
                float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                Move(0, (int)((gravitation * t)), map); //v(t)=-g*t
            }
            else
            {
                fall = false;
            }

            //Sprung fortführen
            if (jump)
            {
                Jump(gameTime, map);
            }
        }
        public void Update(GameTime gameTime, Map map,Rectangle hero)
        {
            speed = Convert.ToInt32((double)Game1.luaInstance["playerSpeed"]);
            airspeed = Convert.ToInt32((double)Game1.luaInstance["playerAirspeed"]);
            jumppower = Convert.ToInt32((double)Game1.luaInstance["playerJumppower"]);
            gravitation = Convert.ToInt32((double)Game1.luaInstance["playerGravitation"]);

            //Geschwindigkeit festlegen
            int actualspeed = speed;
            if (jump || fall)
            {
                actualspeed = airspeed;
            }
            //Einfluss Gamepad
            if (ishit)
            {
                if (lifes != 0)
                {
                    if (!hitrichtung) //rechts fliegend
                    {
                        actualspeed = -actualspeed;
                    }
                    Move((int)actualspeed*2, 0, map);
                    flytime += gameTime.ElapsedGameTime.TotalMilliseconds / 1000;
                    if (flytime > flymaxtime || CollisionCheckedVector(0, 1, map.blocks, map).Y == 0)
                    {
                        ishit = false;
                    }
                }

            }
            else
            {
                if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X != 0)
                {
                    actualspeed = (int)((float)actualspeed * Math.Abs(GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X));
                }
                //-----Sprung-----
                if ((Game1.input.sprung || savejump))
                {
                    if (!jump && !fall && Game1.input.sprungp)
                    {
                        Sound.Play("sweetcheeks_jump");
                        spine.Clear(0);
                        spine.anim("jump", 0, false);
                        Jump(gameTime, map); //Springen!
                        savejump = false;
                    }
                    else if (fall)
                    {
                        savejump = true;
                    }
                    else
                    {
                        savejump = false;
                    }
                }
                else
                {
                    if (jump && !Game1.input.sprungp)
                    {
                        jumptimer -= GameScreen.slow + Convert.ToInt32((double)Game1.luaInstance["playerJumpCutoff"]);
                    }
                }
                //-----Schlag / Smash starten-----
                if (Game1.input.smash)
                {
                    if (jump || fall)
                    {
                        if (Game1.time.TotalMilliseconds > (smashTimer + smashCooldown)) //Smash beginnen
                        {
                            Sound.Play("sweetcheeks_siren_scream");
                            jump = false;
                            fall = true;
                            hit = false;
                            smash = true;
                            spine.anim("scream", 3, false);
                            smashTimer = Game1.time.TotalMilliseconds;
                            falltimer = Game1.time.TotalMilliseconds;
                            screamtime = 0;
                        }
                    }
                }
                else if (Game1.input.hit)
                {
                    if (!smash && !hit) //Schlag beginnen
                    {
                        Sound.Play("sweetcheeks_attack");
                        Sound.Play("schlag");
                        hit = true;
                        spine.anim("attack", 0, false);
                        hitTimer = Game1.time.TotalMilliseconds;
                    }
                }
                //Schlag ggf beenden
                if (hit && Game1.time.TotalMilliseconds > hitTimer + (spine.skeleton.Data.FindAnimation("attack").Duration * 1000))
                {
                    hit = false;
                    spine.animationState.ClearTrack(1);
                }
                //Smash fortführen
                if (smash)
                {
                    screamtime += gameTime.ElapsedGameTime.TotalMilliseconds / 1000;
                    if (screamtime > screamend)
                    {
                        screamradius = 0;
                        smash = false;
                    }
                    else
                    {
                        falltimer = Game1.time.TotalMilliseconds;
                        if (screamradius < maxscreamradius && screamtime > screamstart)
                            screamradius += maxscreamradius / 40;
                    }
                }
                if (!smash)
                {
                    //-----Move-----
                    if (Game1.input.rechts) //Wenn Rechte Pfeiltaste
                    {
                        richtung = true;
                        acceleration += 1 / (60 * initAcceleration);
                        if (Math.Abs(acceleration) <= 2 / (60 * initAcceleration) || Math.Abs(acceleration) > initAcceleration) //Drehen bzw weiter laufen
                        {
                            if (!jump && !fall)
                            {
                                spine.anim("run", 1, true);
                            }
                            else
                            {
                                spine.anim("jump", 1, false);
                            }
                        }
                        else if (spine.flipSkel && Math.Abs(acceleration) <= 2 / (60 * initAcceleration)) //Bei direktem Richtungstastenwechsel trotzdem beim Abbremsen in idle übergehen
                        {
                            if (!jump && !fall)
                            {
                                spine.anim("idle", 0, true); //In idle-Position übergehen
                            }
                        }
                        if (jump || fall) //Zusätzliche Beschleunigung in der Luft
                        {
                            acceleration += 2 / (60 * initAcceleration);
                        }
                    }
                    else if (Game1.input.links) //Wenn Rechte Pfeiltaste
                    {
                        richtung = false;
                        acceleration -= 1 / (60 * initAcceleration);
                        if (Math.Abs(acceleration) <= 2 / (60 * initAcceleration) || Math.Abs(acceleration) > initAcceleration) //Drehen bzw weiter laufen
                        {
                            if (!jump && !fall)
                            {
                                spine.anim("run", 2, true);
                            }
                            else
                            {
                                spine.anim("jump", 2, false);
                            }
                        }
                        else if (!spine.flipSkel && Math.Abs(acceleration) <= 2 / (60 * initAcceleration)) //Bei direktem Richtungstastenwechsel trotzdem in idle übergehen
                        {
                            if (!jump && !fall)
                            {
                                spine.anim("idle", 0, true); //In idle-Position übergehen
                            }
                        }
                        if (jump || fall) //Zusätzliche Beschleunigung in der Luft
                        {
                            acceleration -= 2 / (60 * initAcceleration);
                        }
                    }
                    else
                    {
                        //Auslaufen_Abbremsen
                        if (acceleration < 0)
                        {
                            acceleration += 1 / (60 * initAcceleration);
                            if (acceleration > 0) //Nicht umdrehen
                            {
                                acceleration = 0;
                            }
                        }
                        else if (acceleration > 0)
                        {
                            acceleration -= 1 / (60 * initAcceleration);
                            if (acceleration < 0) //Nicht umdrehen
                            {
                                acceleration = 0;
                            }
                        }
                        if (!jump && !fall)
                        {
                            spine.anim("idle", 0, true); //In idle-Position übergehen
                        }
                    }
                    //Keine Beschleunigungs"vermehrung", durch Beschleunigung wird nur MaxSpeed bei jedem Update absolut vermindert. Fake aber funzt...
                    if (acceleration < -initAcceleration)
                    {
                        acceleration = -initAcceleration;
                    }
                    if (acceleration > initAcceleration)
                    {
                        acceleration = initAcceleration;
                    }
                    if (Math.Abs(CollisionCheckedVector((int)((acceleration / initAcceleration) * actualspeed), 0, map.blocks, map, hero).X) < Math.Abs((int)((acceleration / initAcceleration) * actualspeed)))
                    {
                        acceleration = -acceleration * 0.8f;
                    }
                    Move((int)((acceleration / initAcceleration) * actualspeed), 0, map);
                }
            }

            //Gravitation
            if (CollisionCheckedVector(0, 1, map.blocks, map).Y > 0 && !jump)
            {
                Console.WriteLine("JOOO");
                if (CollisionCheckedVector(0, 1, map.blocks, map, hero).Y == 0)
                {
                    if(richtung)
                        Move(actualspeed*2, 0, map);
                    else
                        Move(-actualspeed*2, 0, map);
                }
                else
                {
                    if (!fall)
                    {
                        fall = true;
                        falltimer = Game1.time.TotalMilliseconds;
                    }
                    float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                    Move(0, (int)((gravitation * t)), map); //v(t)=-g*t
                    if (!smash)
                        spine.anim("jump", 0, false);
                }
            }
            else
            {
                if (fall)
                {
                    fall = false;
                    Sound.Play("land");
                }
            }

            //Sprung fortführen
            if (jump)
            {
                Jump(gameTime, map);
            }
            position.Y = spine.skeleton.Y;
            position.X = spine.skeleton.X;
        }
        public override void Update(GameTime gameTime, Map map,Vector2 heropos)
        {
            speed = Convert.ToInt32((double)Game1.luaInstance["monkeySpeed"]);
            if (GameScreen.slow != 0)
            {
                speed = speed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
            }
            gravitation = Convert.ToInt32((double)Game1.luaInstance["monkeyGravitation"]);
            if (moving)
            {
                if (Math.Abs(position.X - heropos.X) <= Convert.ToInt32((double)Game1.luaInstance["monkeyThrowRange"]))
                {
                    moving = false;
                }
                else
                {

                    if (mover)
                    {
                        if (CollisionCheckedVector(speed, 0, map.blocks).X != 0)
                        {
                            Move(speed, 0, map);//Bewege Rechts
                            if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                            {
                                mover = false;
                                Move(-speed, 0, map);
                            }
                        }
                        else
                        {
                            mover = false;
                        }
                    }
                    else
                    {
                        if (CollisionCheckedVector(-speed, 0, map.blocks).X != 0)
                        {
                            Move(-speed, 0, map);//Bewege Links
                            if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                            {
                                mover = true;
                                Move(speed, 0, map);
                            }
                        }
                        else
                        {
                            mover = true;
                        }
                    }
                    if (mover)
                        spine.anim("walking", 1, true);
                    else
                        spine.anim("walking", 2, true);
                }
            }
            if (!moving)
            {
                bool move = false;
                if (Math.Abs(position.X - heropos.X) <= Convert.ToInt32((double)Game1.luaInstance["monkeyThrowRange"]))
                {
                    if (position.X > heropos.X)
                        mover = true;
                    else
                        mover = false;
                    if (animeTime <= 0)
                    {
                        if (position.X < heropos.X)
                        {
                            map.objects.Add(new Kacke(new Vector2(cbox.box.X, cbox.box.Y), 2, true));
                        }
                        else
                        {
                            map.objects.Add(new Kacke(new Vector2(cbox.box.X, cbox.box.Y), 2, false));
                        }
                        animeTime = 1;
                        if (mover)
                            spine.anim("attack", 2, true);
                        else
                            spine.anim("attack", 1, true);
                    }
                    else
                    {
                        animeTime -= gameTime.ElapsedGameTime.TotalSeconds;
                        if (animeTime < 0.5f)
                        {
                            if (mover)
                                spine.anim("walking", 1, true);
                            else
                                spine.anim("walking", 2, true);
                            move = true;
                        }
                    }
                    if (move)
                    {
                        if (!mover)
                        {
                            speed = -speed;
                        }
                        if (CollisionCheckedVector(speed, 0, map.blocks).X != 0)
                        {
                            Move(speed, 0, map);//Bewege Rechts
                            if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
                            {
                                Move(-speed, 0, map);
                            }
                        }
                    }
                }
                else
                {
                    if (mover)
                        spine.anim("sitting", 1, true);
                    else
                        spine.anim("sitting", 2, true);

                }
            }

            //Gravitation
            if (CollisionCheckedVector(0, 1, map.blocks).Y > 0)
            {
                if (!fall)
                {
                    fall = true;
                    falltimer = Game1.time.TotalMilliseconds;
                }
                float t = (float)((Game1.time.TotalMilliseconds - falltimer) / 1000);
                Move(0, (int)((gravitation * t)), map); //v(t)=-g*t
            }
            else
            {
                fall = false;
            }
            foreach (MovingBlock block in map.mblocks)
            {
                Rectangle collide = new Rectangle(cbox.box.X, cbox.box.Y + 1, cbox.box.Width, cbox.box.Height);
                //Wenn Kollision vorliegt: Keinen weiteren Block abfragen
                int movespeed = Convert.ToInt32((double)Game1.luaInstance["blockSpeed"]);
                if (block.move == 2)
                    movespeed = -movespeed;
                if (collide.Intersects(block.cbox))
                {
                    if (GameScreen.slow != 0)
                    {
                        movespeed = movespeed / Convert.ToInt32((double)Game1.luaInstance["itemSlowReduce"]);
                    }
                    Move(movespeed, 0, map);
                    break;
                }

                collide.Y = cbox.box.Y;
                collide.X = cbox.box.X - movespeed;
                if (collide.Intersects(block.cbox))
                {
                    if (CollisionCheckedVector(movespeed, 0, map.blocks).X == movespeed)
                    {
                        Move(movespeed, 0, map);
                        break;
                    }
                    else
                    {
                        if (block.move == 1)
                            block.move = 2;
                        else
                            block.move = 1;
                        break;
                    }
                }
            }
        }
 public override void Update(GraphicsDeviceManager graphics, Player spieler, Map karte)
 {
     viewport.Y = 0;
     viewport.X = 0;
     UpdateTransformation(graphics); //Abgekapselt damit Camera für Menü ohne Spieler verwendbar ist.
 }
 public void SpawnCloud(Map karte, Camera camera)
 {
     //Entscheiden ob Wolke gespawned werden soll
     testSpawn = randomNumber.Next(0, 100);
     if (testSpawn >= luaChaos)
     {
         //Wolkentyp bestimmen
         testType = randomNumber.Next(0, 10);
         int type = 1;
         if (testType < luaType)
         {
             type = 2;
         }
         //Wolkenposition bestimmen
         testPosition = randomNumber.Next(0, 100);
         int spawnPosition = ((int)((luaBottom - luaTop) * ((float)testPosition / 100))) + luaTop;
         //Wolke erstellen
         testSize = randomNumber.Next(luaSizeMin, luaSizeMax);
         clouds.Add(new Cloud(type, new Vector2(size.X, spawnPosition), (float)testSize / 100));
     }
 }