public Controls(Game1 game,GlassesUI glasses) { this.game = game; this.glasses = glasses; speed = new Vector2(PLAYERBASESPEED,0); direction = new Vector2(0,0); }
public GlassesSprite(Game game, Texture2D tileSheet, Texture2D backgroundHighlight, SpriteBatch Batch, Vector2 pos, MapLoader.TileType t, GlassesUI.Glasses glassesType = GlassesUI.Glasses.Light) : base(game, tileSheet, Batch, pos, t, false) { glasses = glassesType; background = backgroundHighlight; }
/// <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); // Create a rendertarget that matches the back buffer's dimensions, does not generate mipmaps automatically // (the Reach profile requires power of 2 sizing in order to do that), uses an RGBA color format, and // has no depth buffer or stencil buffer. renderTarget = new RenderTarget2D (GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth,GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None); TileSheet = Content.Load<Texture2D>("tilesheet.png"); font = Content.Load<SpriteFont>("spriteFont1"); animatedTilesheet = Content.Load<Texture2D>("AnimationTiles.png"); fps = new FPSCounterComponent(this,spriteBatch,font); level = MapLoader.ReadFile("./Content/map.txt", TileSheet,animatedTilesheet, this); glasses = new GlassesUI(this, spriteBatch); player = new Player(this); Vector2 playerPos = new Vector2( (this.Window.ClientBounds.Width / 2 ) - 16, (this.Window.ClientBounds.Height / 2) - 32 ); this.controls = new Controls(this,glasses); player.Initalise(this,animatedTilesheet,spriteBatch,playerPos); bkgnd.Initialise(Content.Load<Texture2D>("Background2"),800); Components.Add(fps); }