public Characters() { InitializeComponent(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; playerReady = 0; Player Knight = new Player(0, new Point(0,0)); LordKnight = new Bitmap(Knight.getFrontBitmap(), pbChar1.Width, pbChar1.Height); Player Woman = new Player(1, new Point(0, 0)); Marian = new Bitmap(Woman.getFrontBitmap(), pbChar2.Width, pbChar2.Height); Player Ninja = new Player(2, new Point(0, 0)); NinjaJustin = new Bitmap(Ninja.getFrontBitmap(), pbChar3.Width, pbChar3.Height); Player Sir = new Player(3, new Point(0, 0)); SirDavid = new Bitmap(Sir.getFrontBitmap(), pbChar4.Width, pbChar4.Height); Player King = new Player(4, new Point(0, 0)); KingPatrick = new Bitmap(King.getFrontBitmap(), pbChar5.Width, pbChar5.Height); Player Pope = new Player(5, new Point(0, 0)); PopeRoman = new Bitmap(Pope.getFrontBitmap(), pbChar6.Width, pbChar6.Height); fillPictureBoxes(); }
public Map(int Mapsize,int Anzahlitems,int playerid1, int playerid2 /*int MapPointSize*/) { this.Mapsize = Mapsize; Board = new Mappoint[Mapsize, Mapsize]; files = new FileManager(); this.screen =new Gamescreen(); //this.MappositionX = MappositionX; //this.MappositionY = MappositionY; //this.MapPointSize = MapPointSize; exchangeCard = new Mappoint(files.randomBitmap()); this.usedProps = new Dictionary<String,Bitmap>(); //Ein Mappoint zum Verschieben wird beim ersten mal zufällig erstellt ran = new Random(); player1 = new Player(playerid1, new Point(0,0)); player2 = new Player(playerid2, new Point(Mapsize-1,Mapsize-1)); this.Randomwert = Anzahlitems; }
private void nextStepPlayer() { if (first.getConnectedPaths(activePlayer.getMapPosition(screen)).Count == 1) { activePlayer.pushAviable = false; if (activePlayer.playerId == 1) { activePlayer = first.player2; } else { activePlayer = first.player1; } activePlayer.moveAviable = false; activePlayer.pushAviable = true; if (activePlayer.playerId == 1) { label1.Text = "P1 schiebt"; } else { label1.Text = "P2 schiebt"; } } else { activePlayer.moveAviable = true; activePlayer.pushAviable = false; if (activePlayer.playerId == 1) { label1.Text = "P1 geht"; } else { label1.Text = "P2 geht"; } } }
private void playerTimer_Tick(object sender, EventArgs e) { timerCounter++; if (Math.Abs(activePlayer.counterX) == pixelCounter || Math.Abs(activePlayer.counterY) == pixelCounter) { playerTimer.Enabled = false; ; activePlayer.counterX = 0; activePlayer.counterY = 0; //playerTimer.Stop(); commandListPos ++; if (commandListPos < commandCount) useCommand(commandListPos); else if (commandListPos == commandCount) { foundProp(activePlayer.getMapPosition(screen)); if (activePlayer.playerId == 1) { activePlayer = first.player2; label1.Text = "P2 schiebt"; } else { activePlayer = first.player1; label1.Text = "P1 schiebt"; } foundProp(activePlayer.getMapPosition(screen)); activePlayer.pushAviable = true; } Invalidate(new Rectangle(screen.Playeraction.X, screen.Playeraction.Y, 500, 200)); } else { activePlayer.counterX += direction.X; activePlayer.counterY += direction.Y; activePlayer.setPositionPixel(activePlayer.positionPixel.X + direction.X, activePlayer.positionPixel.Y + direction.Y); int times = timerCounter / 50; int nr = timerCounter - times * 50; activePlayer.shownBitmap = activePlayer.usedAnimation[Convert.ToInt32(nr / 25)]; Invalidate(new Rectangle(activePlayer.positionPixel.X + direction.X, activePlayer.positionPixel.Y, screen.MapPointSize, screen.MapPointSize)); } }
private void Form1_Load(object sender, EventArgs e) { first.player1.setPositionPixel(screen); first.player1.playerId = 1; first.player2.setPositionPixel(screen); first.player2.playerId = 2; label1.Visible = false; int startplayer = 1; if (startplayer == 1) { label1.Text = "P1 schiebt"; first.player1.pushAviable = true; activePlayer = first.player1; } else { label1.Text = "P2 schiebt"; first.player2.pushAviable = true; activePlayer = first.player2; } }