Esempio n. 1
0
 public override void Draw()
 {
     this.Texture = animation.Texture;
     Render.DrawAnimation(Texture, this.Pos + new Vector2f(-15, 26), Color.White, new Vector2f(Texture.Size.X / (animation.Count * 6),
                                                                                               Texture.Size.Y - animation.YOffset), 1, animation.Count, animation.Frame, 1);
     //Render.Draw(animation., this.Pos, Color.White, new Vector2f(0, 0), 1, 0);
     base.Draw();
 }
Esempio n. 2
0
        public override void Draw()
        {
            animation.Update();
            this.Texture = animation.Texture;
            if (animation.Frame >= animation.Count - 1)
            {
                MainGame.dm.GameObjects.Remove(this);
            }
            Render.DrawAnimation(Texture, this.Pos, new Color(255, 255, 255, 200), new Vector2f(8, 8), 1, animation.Count, animation.Frame, 1, Rot);

            base.Draw();
        }
Esempio n. 3
0
        public override void Draw()
        {
            animation.Update();
            this.Texture = animation.Texture;
            if (animation.Frame >= animation.Count - 1)
            {
                MainGame.dm.GameObjects.Remove(this);
            }
            //new Color(224,164,145, 200) //brownish
            Render.DrawAnimation(Texture, this.Pos, new Color(255, 255, 255, 100), new Vector2f(16, 8), 1, animation.Count, animation.Frame, 1, Rot, scale);

            base.Draw();
        }
Esempio n. 4
0
        public override void Draw()
        {
            if (!Alive)
            {
                return;
            }

            Core                = Pos - new Vector2f(-1, 35);
            this.Texture        = animation.Texture;
            Render.renderStates = Actor.shader;
            Texture pistolHand    = Content.GetTexture(model.pistolHand);
            Texture weaponTexture = weapon.texture;

            if (ouchTimer > 0)
            {
                shader.Shader.SetParameter("ouch", 1f);
            }
            else
            {
                shader.Shader.SetParameter("ouch", 0f);
            }

            shader.Shader.SetParameter("sampler", pistolHand);
            Render.Draw(pistolHand, Core, Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1);
            shader.Shader.SetParameter("sampler", weaponTexture);
            Render.Draw(weaponTexture, Core, Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1);
            shader.Shader.SetParameter("sampler", Texture);
            Render.DrawAnimation(Texture, this.Pos, Color.White, new Vector2f(Texture.Size.X / (animation.Count * 4),
                                                                              Texture.Size.Y - animation.YOffset), Facing, animation.Count, animation.Frame, 1);
            Render.renderStates = null;

            //Render.DrawString(Content.GetFont("Font1.ttf"), Name, Core - new Vector2f(0, 40), Color.White, .3f, true, 1);

            if (!Name.Equals(null))
            {
                Render.DrawString(Content.GetFont("PixelSix.ttf"), Name, this.Core - new Vector2f(0, 40), Color.White, .3f, true, 1);
            }

            base.Draw();
        }
Esempio n. 5
0
        public override void Draw()
        {
            //blue sky
            MainGame.window.SetView(MainGame.window.DefaultView);
            shader.Shader.SetParameter("offsetY", MainGame.Camera.Center.Y);
            RectangleShape rs = new RectangleShape
            {
                Size = new Vector2f(800, 600)
            };

            MainGame.window.Draw(rs, shader);
            MainGame.window.SetView(MainGame.Camera);

            //background
            Render.Draw(Content.GetTexture("background1Far.png"), new Vector2f(-200, -100), Color.White, new Vector2f(0, 0), 1, 0f);
            Render.Draw(Content.GetTexture("background1Far.png"), new Vector2f(145, -100), Color.White, new Vector2f(0, 0), 1, 0f);
            Render.Draw(Content.GetTexture("background1.png"), new Vector2f(-200, -150), Color.White, new Vector2f(0, 0), 1, 0f);

            //tracks
            RectangleShape tracks = new RectangleShape(new Vector2f(800, .5f));

            tracks.Position  = new Vector2f(-400, -49);
            tracks.FillColor = new Color(10, 10, 10, 50);
            tracks.Draw(MainGame.window, RenderStates.Default);

            //train
            Render.Draw(Content.GetTexture("mapDecor.png"), new Vector2f(trainPosX, -55), new Color(255, 255, 255, 200), new Vector2f(0, 0), 1, 0f, .03f);

            //title
            Render.Draw(Content.GetTexture("title.png"), new Vector2f(-50, -190), new Color(255, 255, 255, 240), new Vector2f(0, 0), 1, 0f, .4f);


            if (stage == 0)
            {
                //menubox
                RectangleShape rectBG = new RectangleShape(new Vector2f(200, 110));
                rectBG.Position  = new Vector2f(-50, 0);
                rectBG.FillColor = new Color(10, 10, 10, 100);
                rectBG.Draw(MainGame.window, RenderStates.Default);

                if (!submitted)
                {
                    //menu username
                    rectUsername.FillColor = new Color(10, 10, 10, (byte)(composingUsername ? 150 : 50));
                    rectUsername.Draw(MainGame.window, RenderStates.Default);

                    //menu ip
                    rectIP.FillColor = new Color(10, 10, 10, (byte)(composingIP ? 150 : 50));
                    rectIP.Draw(MainGame.window, RenderStates.Default);

                    //menu connect button
                    rectConnect.FillColor = new Color(10, 255, 10,
                                                      (byte)(rectConnect.GetGlobalBounds().Contains(
                                                                 (int)MainGame.worldMousePos.X, (int)MainGame.worldMousePos.Y) ? 150 : 70));
                    rectConnect.Draw(MainGame.window, RenderStates.Default);

                    //text: username, ip, connect button
                    Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), usernameField, new Vector2f(50, 15), Color.White, .3f, true, 1);
                    Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), ipField, new Vector2f(50, 45), Color.White, .3f, true, 1);
                    Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Connect", new Vector2f(50, 77), Color.White, .4f, true, 1);
                }
                else
                {
                    Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Connecting...", new Vector2f(50, 15), Color.White, .3f, true, 1);
                    submitTimer++;
                    if (submitTimer > 300)
                    {
                        submitted   = false;
                        submitTimer = 0;
                        ipField     = "Failed to Connect";
                    }
                }
            }
            if (stage == 1)
            {
                RectangleShape rectBG = new RectangleShape(new Vector2f(200, 110));
                rectBG.Position  = new Vector2f(-50, 0);
                rectBG.FillColor = new Color(10, 10, 10, 100);
                rectBG.Draw(MainGame.window, RenderStates.Default);

                //char1.Update();
                //char2.Update();

                Render.DrawAnimation(char1.Texture, new Vector2f(-0, 5), Color.White, new Vector2f(0, 0), 1, char1.Count, char1.Frame);
                Render.DrawAnimation(char2.Texture, new Vector2f(100, 5), Color.White, new Vector2f(0, 0), -1, char2.Count, char2.Frame);

                //Render.Draw(Content.GetTexture("gibHead.png"), new Vector2f(40, 10), Color.White, new Vector2f(0, 0), 1, 0, 2);
                //Render.Draw(Content.GetTexture("char2_gibHead.png"), new Vector2f(0, 10), Color.White, new Vector2f(0, 0), 1, 0, 2);

                FloatRect leftRect  = new FloatRect(new Vector2f(0, 5), new Vector2f(20, 55));
                FloatRect rightRect = new FloatRect(new Vector2f(75, 5), new Vector2f(20, 55));

                if (leftRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y))
                {
                    currentCursor = hoverCursor;
                    if (Input.isMouseButtonTap(Mouse.Button.Left))
                    {
                        stage = 2;
                        MainGame.dm.player.model = MainGame.Char1Model;
                        MainGame.dm.player.UpdateToCurrentModel();
                        return;
                    }
                }
                if (rightRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y))
                {
                    currentCursor = hoverCursor;
                    if (Input.isMouseButtonTap(Mouse.Button.Left))
                    {
                        stage = 2;
                        MainGame.dm.player.model = MainGame.Char2Model;
                        MainGame.dm.player.UpdateToCurrentModel();
                        return;
                    }
                }


                rectConnect.Draw(MainGame.window, RenderStates.Default);
                Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Select Character", new Vector2f(50, 77), Color.White, .4f, true, 1);
            }
            if (stage == 2)
            {
                RectangleShape rectBG = new RectangleShape(new Vector2f(200, 110));
                rectBG.Position  = new Vector2f(-50, 0);
                rectBG.FillColor = new Color(10, 10, 10, 100);
                rectBG.Draw(MainGame.window, RenderStates.Default);

                Render.Draw(Content.GetTexture("generatorStand.png"), new Vector2f(-10, 5), Color.White, new Vector2f(0, 0), 1, 0f);
                Render.Draw(Content.GetTexture("genBlue.png"), new Vector2f(-10, 5), Color.White, new Vector2f(0, 0), 1, 0f);
                Render.DrawString(Content.GetFont("PixelSix.ttf"), "   Shield\nGenerator", new Vector2f(0, 45), Color.White, .3f, true, 1);

                Render.Draw(Content.GetTexture("mine.png"), new Vector2f(40, 30), Color.White, new Vector2f(0, 0), 1, 0f);
                Render.Draw(Content.GetTexture("mine.png"), new Vector2f(40, 30), Color.White, new Vector2f(0, 0), 1, 0f);
                Render.DrawString(Content.GetFont("PixelSix.ttf"), "Land\nMine", new Vector2f(50, 45), Color.White, .3f, true, 1);


                Render.Draw(Content.GetTexture("generatorStand.png"), new Vector2f(90, 5), Color.White, new Vector2f(0, 0), 1, 0f);
                Render.Draw(Content.GetTexture("genGreen.png"), new Vector2f(90, 5), Color.White, new Vector2f(0, 0), 1, 0f);
                Render.DrawString(Content.GetFont("PixelSix.ttf"), "   Health\nGenerator", new Vector2f(100, 45), Color.White, .3f, true, 1);

                FloatRect genShieldRect = new FloatRect(new Vector2f(-10, 5), new Vector2f(20, 55));
                FloatRect genHealthRect = new FloatRect(new Vector2f(90, 5), new Vector2f(20, 55));
                FloatRect MineRect      = new FloatRect(new Vector2f(40, 5), new Vector2f(20, 55));

                if (genShieldRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y))
                {
                    currentCursor = hoverCursor;
                    if (Input.isMouseButtonTap(Mouse.Button.Left))
                    {
                        MainGame.dm.player.ItemType = 3; // Shield Generator
                        Submit();
                    }
                }
                if (genHealthRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y))
                {
                    currentCursor = hoverCursor;
                    if (Input.isMouseButtonTap(Mouse.Button.Left))
                    {
                        MainGame.dm.player.ItemType = 2; // Health Generator
                        Submit();
                    }
                }
                if (MineRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y))
                {
                    currentCursor = hoverCursor;
                    if (Input.isMouseButtonTap(Mouse.Button.Left))
                    {
                        MainGame.dm.player.ItemType = 1; // Land Mines
                        Submit();
                    }
                }

                rectConnect.Draw(MainGame.window, RenderStates.Default);
                Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Select Item", new Vector2f(50, 77), Color.White, .4f, true, 1);
            }
            //cursor
            Render.Draw(currentCursor, MainGame.worldMousePos, Color.White, new Vector2f(0, 0), 1, 0f);
        }
Esempio n. 6
0
        public override void Draw()
        {
            base.Draw();

            if (!Alive)
            {
                return;
            }
            //if (frame == 1)
            //Console.Write(frame);
            //Render.Draw(animation.Texture, this.Pos, Color.White, new Vector2f(0,0), 1, 0,1);
            if (holdDistance < 0)
            {
                holdDistance += -holdDistance * .05f;
            }
            Core         = Pos - new Vector2f(-1, 35);
            this.Texture = animation.Texture;

            Render.renderStates = Actor.shader;
            Texture pistolHand    = Content.GetTexture(model.pistolHand);
            Texture weaponTexture = weapon.texture;

            if (ouchTimer > 0)
            {
                shader.Shader.SetParameter("ouch", 1f);
            }
            else
            {
                shader.Shader.SetParameter("ouch", 0f);
            }

            shader.Shader.SetParameter("sampler", pistolHand);
            Render.Draw(pistolHand, Core + Helper.PolarToVector2(holdDistance, AimAngle, 1, 1), Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1);

            if (weaponTexture != null)
            {
                shader.Shader.SetParameter("sampler", weaponTexture);
                Render.Draw(weaponTexture, Core + Helper.PolarToVector2(holdDistance, AimAngle, 1, 1), Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1);
            }

            shader.Shader.SetParameter("sampler", Texture);
            Render.DrawAnimation(Texture, this.Pos, Color.White, new Vector2f(Texture.Size.X / (animation.Count * 4),
                                                                              Texture.Size.Y - animation.YOffset), Facing, animation.Count, animation.Frame, 1);
            Render.renderStates = null;

            RectangleShape rect = new RectangleShape();

            rect.Position     = new Vector2f((int)Pos.X, (int)Pos.Y);
            rect.Size         = new Vector2f(1, 1);
            rect.FillColor    = Color.White;
            rect.OutlineColor = Color.White;
            //MainGame.window.Draw(rect); //Draw players collision point



            RectangleShape col = new RectangleShape();

            col.Position     = new Vector2f(collisionBox.Left, collisionBox.Top);
            col.Size         = new Vector2f(collisionBox.Width, collisionBox.Height);
            col.FillColor    = Color.White;
            col.OutlineColor = Color.Red;

            FloatRect bgRect = new FloatRect(new Vector2f(this.Core.X, this.Core.Y - 20), new Vector2f(100, 20));

            //RectangleShape rectBG = new RectangleShape();
            //rectBG.Position = new Vector2f(100, 10);
            //rectBG.FillColor = new Color(10, 10, 10, 150);
            //rectBG.Draw(MainGame.window, RenderStates.Default);

            Render.DrawString(Content.GetFont("PixelSix.ttf"), this.Name, this.Core - new Vector2f(0, 40), Color.White, .3f, true, 1);
            //MainGame.window.Draw(col); //Draw players collision box
        }