Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Microsoft.Xna.Framework.Input;
  8. using Microsoft.Xna.Framework.Content;
  9. using Microsoft.Xna.Framework.Graphics;
  10.  
  11. namespace atan_proj06
  12. {
  13. class Barrack : Sprite
  14. {
  15.  
  16. const string BARRACK_ASSETNAME = "barrack";
  17. const int START_POSITION_X = 15;
  18. const int START_POSITION_Y = 0;
  19.  
  20. const int FRAME_COUNT = 1;
  21. TimeSpan FrameLength = TimeSpan.FromSeconds(0.25 / (double) FRAME_COUNT);
  22. TimeSpan FrameTimer = TimeSpan.Zero;
  23.  
  24.  
  25. ContentManager mContentManager;
  26. Enemy enemeyRef;
  27.  
  28. private int FrameNum = 0;
  29.  
  30. public Barrack(GraphicsDevice gDevice)
  31. {
  32. FrameSize = 150;
  33. }
  34.  
  35. public void LoadContent(ContentManager theContentManager)
  36. {
  37. mContentManager = theContentManager;
  38.  
  39. Position = new Vector2(50, 300);
  40.  
  41.  
  42. base.LoadContent(theContentManager, BARRACK_ASSETNAME);
  43.  
  44. Size = new Rectangle(new Point(0, 0), new Point(FrameSize));
  45. }
  46.  
  47. public override void Draw(SpriteBatch theSpriteBatch)
  48. {
  49. theSpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.LinearWrap,
  50. DepthStencilState.Default, RasterizerState.CullNone);
  51. theSpriteBatch.Draw(mSpriteTexture, Position,
  52. new Rectangle(0 + (FrameSize * FrameNum), 0, FrameSize, mSpriteTexture.Height), Color.White,
  53. 0.0f, Vector2.One, Scale, SpriteEffects.None, 0);
  54. theSpriteBatch.End();
  55. }
  56.  
  57. public void Update(GameTime theGameTime)
  58. {
  59. Size.X = (int) Position.X;
  60. Size.Y = (int) Position.Y;
  61. }
  62.  
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement