Example #1
0
 public Hause(GameScreen game) : base(game)
 {
     Solid       = true;
     ColisionBox = new ColisionBox(this);
 }
Example #2
0
        public override void Update(GameTime gameTime)
        {
            spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender");
            MouseState mouse = Mouse.GetState();

            ///checks om musen er inden for knappends område og om der bliver
            ///clickt elelr hovert
            ///

            if (ColisionBox.Contains(mouse.X, mouse.Y))
            {
                if (mouse.LeftButton == ButtonState.Pressed)
                {
                    State = state.Pressed;
                }
                if (mouse.LeftButton == ButtonState.Released)
                {
                    State = state.Hover;
                }
            }
            else
            {
                State = state.none;
            }
            /// maybe losning


            switch (State)
            {
            case state.none:
                CLICK = "non";
                spriteRender.color = Color.White;

                // do somthing
                break;

            case state.Pressed:
                CLICK = "pressed";
                GameWorld.Remove.Add(this.gameObject);
                spriteRender.color = Color.Black;
                foreach (var go in GameWorld.gameObjects)
                {
                    GameWorld.Remove.Add(go);
                }

                Cliket = true;
                break;

            case state.Hover:
                CLICK = "Hover";
                /// do somthing
                spriteRender.color = Color.Red;
                break;

            default:
                break;
            }



            base.Update(gameTime);
        }
Example #3
0
 public Tree(GameScreen game) : base(game)
 {
     ColisionBox = new ColisionBox(this, ColisionBox.BoxType.Circle);
     Solid       = true;
 }
Example #4
0
 public Tree(GameScreen game, Vector2 position, string metaData) : base(game, position, metaData)
 {
     ColisionBox = new ColisionBox(this, ColisionBox.BoxType.Circle);
     Solid       = true;
 }
Example #5
0
        public override void Update(GameTime gameTime)
        {
            spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender");
            MouseState mouse = Mouse.GetState();

            ///checks om musen er inden for knappends område og om der bliver
            ///clickt elelr hovert
            if (ColisionBox.Contains(mouse.X, mouse.Y))
            {
                if (mouse.LeftButton == ButtonState.Pressed)
                {
                    State = state.Pressed;
                }
                if (mouse.LeftButton == ButtonState.Released)
                {
                    State = state.Hover;
                }
            }
            else
            {
                State = state.none;
            }
            /// maybe losning


            switch (State)
            {
            case state.none:
                CLICK = "non";
                // do somthing
                spriteRender.color        = Color.White;
                gameObject.transForm.size = 1;
                break;

            case state.Pressed:
                CLICK = "pressed";
                spriteRender.color = Color.Gray;
                WRITE = true;
                break;

            case state.Hover:
                CLICK = "Hover";
                spriteRender.color        = Color.Salmon;
                gameObject.transForm.size = 1.5f;
                /// do somthing
                break;

            default:
                break;
            }

            if (WRITE == true)
            {
                Names.Write_name1(gameTime);
                if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                {
                    /// smed player1 name i database Hvis vi skal kunne huske det
                    WRITE = false;
                }
            }



            base.Update(gameTime);
        }