public Player(ContentManager Content, World world) { playerSprite = new AnimatedSprite(Content, "player", Width, Height); playerMeleeAttackSprite = new AnimatedSprite(Content, "player", Width*2, Height*2, new Vector2(Width, Height + (Height/2))); this.world = world; pathfinder = new Pathfinder(world); damageFont = Content.Load<SpriteFont>(@"Fonts/Font-8bitoperator JVE"); debugRec = Content.Load<Texture2D>(@"debugRec"); }
public Hud(ContentManager Content, GraphicsDevice graphicsDevice, Player player, World world, NPC_Manager npcManager) { this.graphicsDevice = graphicsDevice; this.player = player; this.world = world; this.npcManager = npcManager; smallFont = Content.Load<SpriteFont>(@"Fonts/Font-PF Ronda Seven"); debugBG = Content.Load<Texture2D>(@"debugRec"); debugBG_R = new Rectangle(10, 10, 300, 150); curser = Content.Load<Texture2D>("HUD/curser"); smallPlayerInfoBG = Content.Load<Texture2D>("HUD/smallPlayerInfoBG"); smallPlayerInfoBG_R = new Rectangle(5, graphicsDevice.Viewport.Height - smallPlayerInfoBG.Height - 5, smallPlayerInfoBG.Width, smallPlayerInfoBG.Height); largePlayerInfoBG = Content.Load<Texture2D>("HUD/largePlayerInfoBG"); largePlayerInfoBG_R = new Rectangle(5, graphicsDevice.Viewport.Height - smallPlayerInfoBG.Height - 10 - largePlayerInfoBG.Height, largePlayerInfoBG.Width, largePlayerInfoBG.Height); }
public Pathfinder(World world) { this.world = world; }
public NPC_Manager(ContentManager content, World gameWorld) { Content = content; NPCs = new List<NPC>(); GameWorld = gameWorld; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); Vector2 playerStartPos = new Vector2(43, 2); Camara.screenResWidth = screenResWidth; Camara.screenResHeight = screenResHeight; Camara.zoom = 1f; input = new InputHandler(this); //groundTiles = new tileSet(TileSizeWidth, TileSizeHeight, Content.Load<Texture2D>(@"tileSets/groundTiles")); gameWorld = new World(Content, "TheWorld", ChunkSizeWidth, ChunkSizeHeight, TileSizeWidth, TileSizeHeight, playerStartPos); player = new Player(Content, gameWorld); player.Position = playerStartPos;// gameWorld.playerStartTile(); npcManager = new NPC_Manager(Content, gameWorld); hud = new Hud(Content, GraphicsDevice, player, gameWorld, npcManager); Camara.Location.X = (player.Position.X) - screenResWidth / 2; Camara.Location.Y = (player.Position.Y) - screenResHeight / 2; }
/// <summary> /// defualt constructer /// </summary> /// <param name="tilePosition">starting position of the npc</param> /// <param name="name">a name for the pc</param> /// <param name="textureName">name of the content this NPC will use</param> /// <param name="npcHeight">height in pixels</param> /// <param name="npcWidth">width in pixels</param> public NPC(ContentManager Content, World world, Vector2 position, string name, string textureName, int npcHeight, int npcWidth) { npcData.Name = name; npcData.NpcHeight = npcHeight; npcData.NpcWidth = npcWidth; npcData.Position = position; npcData.OriginalPosition = npcData.Position; npcData.PixelPosition = npcData.Position * 32; npcData.visiblityRange = 300; npcData.speed = 30; npcData.Direction.X = 1; npcData.maxHP = 10; NpcSprite = new AnimatedSprite(Content, textureName, npcHeight, npcWidth); fontTiny = Content.Load<SpriteFont>(@"Fonts/Font-PF Arma Five"); damageFont = Content.Load<SpriteFont>(@"Fonts/Font-8bitoperator JVE"); pathfinder = new Pathfinder(world); this.world = world; cellPath = new List<Cell>(); randomStep = rand.Next(-15, 15); randomSpeed = rand.Next(0, 5); debugRec = Content.Load<Texture2D>(@"debugRec"); }