예제 #1
0
		public CharacterEntity (GraphicsDevice graphicsDevice)
		{
			if (characterSheetTexture == null) {
				using (var stream = TitleContainer.OpenStream ("Content/HeavySnake2.png")) {
				
					characterSheetTexture = Texture2D.FromStream (graphicsDevice, stream);
				}

				Head = new Animation ();
				Head.AddFrame (new Rectangle (90, 123, 45, 45), TimeSpan.FromSeconds (.25));
				Head.AddFrame (new Rectangle (45, 123, 45, 45), TimeSpan.FromSeconds (.25));
				Head.AddFrame (new Rectangle (0, 123, 45, 45), TimeSpan.FromSeconds (.25));
//				Head.AddFrame (new Rectangle (32, 0, 16, 16), TimeSpan.FromSeconds (.25));

				
			}
		}
예제 #2
0
		public void update(GameTime gameTime)
		{
			
			GetDesiredDirectionFromInput ();
//			this.X += (velocity.X) * (float)gameTime.ElapsedGameTime.TotalSeconds;
//			this.Y += (velocity.Y) * (float)gameTime.ElapsedGameTime.TotalSeconds;
			if (direction == "right")
				this.X++;
			 if (direction == "down") {
				this.Y++;
			}  if (direction == "up")
				this.Y--;
			 if (direction == "left")
				this.X--;
			
			currentAnimation = Head;
			currentAnimation.Update (gameTime);
		}