Example #1
0
 public Player(State state, string name, float x, float y, float width, float height)
     : base(state, name, x, y, width, height, ZTexture.empty)
 {
     playerTexture = new CharacterSpritesheet(Game.getGraphicsDevice(), 130, 120, ContentManager.playerSpritesheet,
                                              Tuple.Create("default", 1), Tuple.Create("idleup", 1), Tuple.Create("idleleft", 1), Tuple.Create("idleright", 1),
                                              Tuple.Create("walkdown", 10), Tuple.Create("walkleft", 10), Tuple.Create("walkup", 10), Tuple.Create("walkright", 10))
                     .getTexture();
     setTexture(playerTexture);
     setVisible(true);
     setCentered(true);
 }
Example #2
0
 public GameObject(State state, string name, float x, float y, float width, float height, ZTexture texture)
 {
     this.state   = state;
     this.name    = name;
     this.x       = x;
     this.y       = y;
     this.texture = texture;
     interactable = false;
     this.height  = height;
     this.width   = width;
     state.screenObjects.Add(this);
 }
Example #3
0
        public override void Initialize()
        {
            m_texture = new ZTexture(m_gameReference, new CommonState("texture", Color.White, new Vector2(30, 100), Vector2.Zero, 1f, 0, 0));
            this.AddToList(m_texture);


            CommonState textState = new CommonState();

            textState.filePath = "spritefont";
            textState.color    = Color.Black;
            textState.position = new Vector2(400, 100);
            textState.origin   = Vector2.Zero;
            textState.scale    = 1f;
            textState.rotation = 0;

            m_welcomeMsg = new ZText(m_gameReference, textState, "Hello, iam a text bounded in a box trying to achieve the purpose for which i was created.", 300);
            this.AddToList(m_welcomeMsg);


            m_timer = new ZTimer(20);
            this.AddToList(m_timer);

            m_sound = new ZSound(m_gameReference, "sound", false);
            this.AddToList(m_sound);


            CommonState animationState = new CommonState();

            animationState.filePath = "animation";
            animationState.color    = Color.White;
            animationState.position = new Vector2(450, 250);
            animationState.scale    = 1f;
            animationState.rotation = 0;
            animationState.origin   = Vector2.Zero;

            m_animation = new ZAnimation(m_gameReference, animationState, 75, 75, 2);
            this.AddToList(m_animation);

            m_exitBtn = new ExitButton(m_gameReference);
            m_exitBtn.OnButtonPress += new Action(m_exitBtn_OnButtonPress);
            this.AddToList(m_exitBtn);

            ZTexture bar      = new ZTexture(m_gameReference, new CommonState("bar", Color.White, new Vector2(400, 500), Vector2.Zero, 1f, 0, 0));
            ZTexture progress = new ZTexture(m_gameReference, new CommonState("progress", Color.White, new Vector2(400, 500), Vector2.Zero, 1f, 0, 0));

            m_loadingBar = new ZLoadingBar(m_gameReference, bar, progress);
            this.AddToList(m_loadingBar);

            base.Initialize();
        }
Example #4
0
 public GameObject(State state, string name, float x, float y, ZTexture texture)
 {
     this.state   = state;
     this.name    = name;
     this.x       = x;
     this.y       = y;
     this.texture = texture;
     interactable = false;
     if (texture.getCurrentTexture() != null)
     {
         height = texture.getCurrentTexture().Height;
         width  = texture.getCurrentTexture().Width;
     }
     state.screenObjects.Add(this);
 }
Example #5
0
 public GameObject(State state, string name, float x, float y, Texture2D texture)
 {
     this.state   = state;
     this.name    = name;
     this.x       = x;
     this.y       = y;
     this.texture = new ZTexture(texture);
     interactable = false;
     if (texture != null)
     {
         height = texture.Height;
         width  = texture.Width;
     }
     state.screenObjects.Add(this);
 }
Example #6
0
        public override void Initialize()
        {
            CommonState normalState = new CommonState();

            normalState.filePath = "btn";
            normalState.color    = Color.White;
            normalState.position = new Vector2(450, 400);
            normalState.origin   = Vector2.Zero;
            normalState.scale    = 1f;
            normalState.rotation = 0;
            m_normalTexture      = new ZTexture(m_gameReference, normalState);

            CommonState highlightedState = new CommonState(normalState);

            highlightedState.filePath = "btnhover";

            m_highlightedTexture = new ZTexture(m_gameReference, highlightedState);

            base.Initialize();
        }
Example #7
0
        //Character ZTexture state names:
        //default (idledown)
        //idleup
        //idleright
        //idleleft
        //walkup
        //walkdown
        //walkleft
        //walkright

        public Character(State state, string name, float x, float y, float width, float height, ZTexture texture)
            : base(state, name, x, y, width, height, texture)
        {
        }
Example #8
0
 public void setTexture(ZTexture newTexture)
 {
     texture = newTexture;
 }
Example #9
0
 public void setTexture(Texture2D newTexture)
 {
     texture = new ZTexture(newTexture);
 }