コード例 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            tile = Content.Load <Texture2D>("2dztest1");

            tiles = new TileFactory(tile, Content.Load <Texture2D>("entity"),
                                    this.Window.ClientBounds.Height, this.Window.ClientBounds.Width);

            //Tank = new entity(Content.Load<Texture2D>("entity"));

            // TODO: use this.Content to load your game content here
        }
コード例 #2
0
        }                                                                                 //bounds of sprite

        public void update(Vector2 pup, Vector2 up)
        {
            pos.Y += up.Y + pup.Y;

            float prevscale = scale;

            scale = TileFactory.getScale(pos);
            if (prevscale > 0 && scale > 0)
            {
                pos.X = (((pos.X - 400) / prevscale) * scale + 400);
            }
            pos.X  += up.X * scale + pup.X * scale;
            drawpos = new Vector2(pos.X, TileFactory.getDrawY(pos.Y));
        }
コード例 #3
0
        public void update()
        {
            drawpos   = pos;
            drawpos.Y = TileFactory.getDrawY(pos.Y);
            scale     = TileFactory.getScale(pos);

            float posX = TileFactory.checkHorizontalBounds(pos.X);

            if (posX < pos.X)
            {
                pos.X -= texture.Width;
            }
            if (posX > pos.X)
            {
                pos.X += texture.Width;
            }
        }
コード例 #4
0
        public int incpos(Vector2 newPOS)
        {
            pos += newPOS;

            newPOS.Y = TileFactory.checkVerticalBounds(pos.Y);

            int ret = 0;

            if (newPOS.Y > pos.Y)
            {
                ret = 1;
            }
            if (newPOS.Y < pos.Y)
            {
                ret = -1;
            }

            pos.Y = newPOS.Y;
            return(ret);
        }