public override void Initialize(Animation animation, Vector2 startPos) { base.Initialize(animation, startPos); health = 10; speed = 8.0f; grounded = false; collision = new Box(pos.X, pos.Y, animation.FrameWidth, animation.FrameHeight); }
public virtual void Initialize(Animation animation, Vector2 startPos) { base.Initialize(startPos); isAnimated = true; this.animation = animation; }
/// <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); Util.pixel = new Texture2D(graphics.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); Util.pixel.SetData(new[] { Color.White }); currentLevel.Initialize(graphics.GraphicsDevice.Viewport.Bounds, Content.Load<Map>(Constants.startMapName)); background.Initialize(Content, Constants.staticBackgroundName, new Dictionary<string, int>(), currentLevel.map.Width); Animation playerAnim = new Animation(); Texture2D playerTex = Content.Load<Texture2D>("square"); playerAnim.Initialize(playerTex, Vector2.Zero, 58, 60, 1, 30, Color.White, 1f, true); player.Initialize(playerAnim, Constants.playerStartPos); }