public Ghost(int GhostTextureSet,SpriteHandler Sprites) { this.TextureSet = GhostTextureSet; this.Sprites = Sprites; this.counter = 0; SetupTexture(); this.xOld = this.xPos; this.yOld = this.yPos; this.colid = false; }
public Player(SpriteHandler Sprites) { this.Sprites = Sprites; this.xPos = 400;//Startvärde this.yPos = 300;//Startvärde this.xOld = this.xPos; this.yOld = this.yPos; this.Sprites.PicturePos.X = this.xPos; this.Sprites.PicturePos.Y = this.yPos; this.TimerForAnimation = 0; this.TimerMax = 100; this.ChangeSet = false; this.points = 0; }
/// <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); this.Textures[0] = Content.Load<Texture2D>(".\\Textures\\Path");//Hämtar .png av vägen this.Textures[1] = Content.Load<Texture2D>(".\\Textures\\Wall");//Hämtar .png av väggen //Laddar in hur banan ska se ut från .txt med "0 / 1 / 2" där 0 är väg 1 är vägg 2 är spawn //Detta läggs i en matris i Map objektet! this.Map.LoadMap("map1.txt"); this.Cherry = Content.Load<Texture2D>(".\\Sprites\\Cherry"); //Ladder in sprites! Pacman, spöken osv this.Sprites = Content.Load<Texture2D>(".\\Sprites\\Sprites"); this.font = Content.Load<SpriteFont>("PointFont"); this.spriteHandler = new SpriteHandler(this.Sprites,24,4,this.Cherry);//Laddar in sprite.png bilden och delar in den i 24 bilder! och säger att vi ska ha 4 spöken samt en cherry this.spriteHandler.PicturePos = new Vector2(100,100);//Ändrar pos på en bilden this.PacMan = new Player(spriteHandler); this.Ghosts = new Ghost[4]; for(int i = 0; i<4; i++){ this.Ghosts[i] = new Ghost(i,spriteHandler); } // TODO: use this.Content to load your game content here }