public Entity(String baseFile_p, int setionSize = 400, bool animated = true) { if (dying) { offset = -Globals.animations[0]; } Globals.WriteDebug("Entity -> Constructor -> ", "Base File is " + baseFile_p, true); Bitmap baseFile = (Bitmap)Image.FromFile(baseFile_p); if (animated) { for (int i = 0; i < Globals.MAXFRAMES; i++) { int layer = 0; if (i >= Globals.MAXFRAMES / 2) { layer = 1; } Rectangle section = new Rectangle(new Point(sectionSize * (i % 4) + ((i % (Globals.MAXFRAMES / 2) + 1) * (sectionSize / 20)), (sectionSize * layer) + ((sectionSize / 20) * (layer + 1))), new Size(sectionSize, sectionSize)); rootImages[i] = Globals.CropImage(baseFile, section); } } else { rootImages[0] = baseFile; } }
public Hud(ref Player newPlayer) { player = newPlayer; drawImageArray = new Bitmap[8]; int x = 0; int y = 0; int size = 400; Bitmap fullImage = (Bitmap)Image.FromFile("Resources/Images/Friendly/" + newPlayer.playerFileName + "/" + newPlayer.playerFileName + "_Idle.png"); for (int i = 0; i < drawImageArray.Length; i++) { size = 400; x = (((i + 1) % 5) * 20) + (i % 4 * 400); y = 0; if (i >= (drawImageArray.Length / 2)) { y = 1; } y = (((y + 1) % 5) * 20) + (y % 4 * 400); drawImageArray[i] = Globals.CropImage(fullImage, new Rectangle(x, y, size, size)); x = drawImageArray[i].Width / 3; y = 0; size = size / 3; drawImageArray[i] = Globals.CropImage(drawImageArray[i], new Rectangle(x, y, size, size)); } }