protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); DebugTextures.LoadTextures(GraphicsDevice); Text.defaultFont = Content.Load <SpriteFont>("fonts\\npc1"); Text.guiFont = Content.Load <SpriteFont>("fonts\\gui"); Cell.CreateGrid(new Point(-3200, -3200), 500, 500); Dialogue.InitializeDialogueSystem(graphics.GraphicsDevice.Viewport); map = new Map(); screenCenter = new Vector2(gameWidth / 2f, gameHeight / 2f); character = new Character(); map.npcs.Add(new NPC(new Vector2(100, -100), DebugTextures.GenerateRectangle(16, 32, Color.Yellow), "Hello world!!", "Great to see you decided to play this game!!")); map.npcs.Add(new NPC(new Vector2(150, 10), DebugTextures.GenerateRectangle(16, 32, Color.Yellow), "Hello, my name is tommy! I used to live in peace", "watering me plants in me garden everyday, until the unpredictable struck")); map.enemies.Add(new PeasantSoldier(50f, 0.005f, 200f, 300f, 100, screenCenter, DebugTextures.GenerateRectangle(16, 16, Color.DarkGray), character)); map.enemies.Add(new PeasantSoldier(86, 0.004f, 200f, 300f, 100, new Vector2(53, 3466), DebugTextures.GenerateRectangle(16, 16, Color.GreenYellow), character)); map.enemies.Add(new PeasantSoldier(70f, 0.004f, 200f, 300f, 100, new Vector2(62, 23), DebugTextures.GenerateRectangle(16, 16, Color.DarkRed), character)); map.enemies.Add(new PeasantSoldier(69f, 0.004f, 200f, 300f, 100, new Vector2(97, 2), DebugTextures.GenerateRectangle(16, 16, Color.Red), character)); map.enemies.Add(new PeasantSoldier(82f, 0.004f, 200f, 300f, 100, new Vector2(64, 0), DebugTextures.GenerateRectangle(16, 16, Color.Yellow), character)); map.enemies.Add(new PeasantSoldier(56f, 0.004f, 200f, 300f, 100, new Vector2(2, 49), DebugTextures.GenerateRectangle(16, 16, Color.Blue), character)); Vector2 pos = Cell.SnapToGrid(Vector2.One * 40); map.objects.Add(new Wall(pos, 64, 64, true)); Raycast.RayCastTest(); }
public Character() { isInteracting = false; position = new Vector2(200, 200); gun = new Gun(10f, 10f, true, position, new Bullet(7.5f, BulletType.Normal), "character"); sprite = DebugTextures.GenerateRectangle(16, 32, Color.PaleVioletRed); A = Vector2.Zero; // top left B = new Vector2(sprite.Width, 0); // top right C = new Vector2(0, sprite.Width); // bottom left D = new Vector2(sprite.Width, sprite.Height); // bottom right origin = new Vector2(sprite.Width / 2f, sprite.Height / 2f); camera = new Camera(new Vector2(0, 0), -500, 500, -500, 500); health = maxHealth; gui = new Gui(maxHealth); prevKeyState = Keyboard.GetState(); prevMouseState = Mouse.GetState(); collider = new Collider(position, sprite.Width, sprite.Height, "character", this); Game1.instance.map.colliders.Add(collider); cell = Cell.GetCell(position); cell.colliders.Add(collider); }
public static void InitializeDialogueSystem(Viewport viewport) { //dialogueBox = Game1.content.Load<Texture2D>("textures\\ui\\dialogue_box"); dialogueBox = DebugTextures.GenerateRectangle(200, 50, new Color(new Vector4(0.15686274509803921568627450980392f, 0.15686274509803921568627450980392f, 0.15686274509803921568627450980392f, 1f))); DialogueBoxPosition = new Vector2(-dialogueBox.Width / 2, Game1.gameHeight / 4); DialoguePosition = DialogueBoxPosition * Game1.resolutionScale + new Vector2(viewport.Width, viewport.Height) / 2 + new Vector2(15, 25); //Game1.instance.resolutionScale; }
public Bar(int width, int height, Color color1, Color color2, Color backgroundColor, int borderThickness = 0, float startValue = 0f) { Value = startValue; this.color1 = color1; this.color2 = color2; this.width = width; this.height = height; progress = DebugTextures.GenerateRectangle(width, height, Color.White); if (borderThickness > 0) { border = DebugTextures.GenerateHollowRectangele(width, height, borderThickness, Color.Black); origin = new Vector2(border.Width / 2f, border.Height / 2f); } if (backgroundColor != Color.Transparent) { this.backgroundColor = backgroundColor; background = DebugTextures.GenerateRectangle(progress.Width, progress.Height, Color.White); transparent = false; } else { transparent = true; } if (color2 == null) { color2 = color1; } }
public HealthBar() { Value = 1f; sprite = DebugTextures.GenerateHollowRectangele(10, 5, 1, Color.Black); progress = DebugTextures.GenerateRectangle(10, 5, Color.White); origin = new Vector2(sprite.Width / 2f, sprite.Height / 2f); }
public void DrawDebug(SpriteBatch batch) { if (debugSprite != null) { batch.Draw(debugSprite, position, null, Color.White, 0f, debugOrigin, 1f, SpriteEffects.None, 0f); // fiiix mee } Texture2D tx = DebugTextures.GenerateRectangle(10, 10, Color.White); batch.Draw(tx, position, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); // fiiix mee }
public void Initialize(Vector2 position, float rotation, Vector2 forwardDirection) { sprite = DebugTextures.GenerateRectangle(8, 3, Color.Black); origin = new Vector2(sprite.Width / 2f, sprite.Height / 2f); this.position = position; this.rotation = rotation + MathHelper.PiOver2; this.forwardDirection = forwardDirection; }
public SceneObject(int width, int height, bool stationary) { this.width = width; this.height = height; this.stationary = stationary; collider = new Collider(position, width, height, "sceneobject", this); Game1.instance.map.colliders.Add(collider); sprite = DebugTextures.GenerateRectangle(width, height, Color.PowderBlue); origin = new Vector2(width / 2f, height / 2f); cell = Cell.GetCell(position); cell.colliders.Add(collider); }
public Gun(float damage, float fireRate, bool autoFire, Vector2 position, Bullet bullet, params string[] avoid) { this.damage = damage; this.fireRate = fireRate; this.autoFire = autoFire; this.position = position; this.bullet = bullet; this.avoid = avoid; //sprite = Game1.content.Load<Texture2D>("textures\\laser_pistol"); sprite = DebugTextures.GenerateRectangle(5, 10, Color.DarkGreen); origin = new Vector2(sprite.Width / 2f, sprite.Height / 2f); bullets = new List <Bullet>(); prevMouseState = Mouse.GetState(); }
public static void RayCastTest() { sprite = DebugTextures.GenerateRectangle(4, 4, Color.White); origin = new Vector2(sprite.Width / 2f, sprite.Height / 2f); }
public static Button Debug(string text, int width, int height, Color color, onPressed onPressed) { return(new Button(latestButtonPosition + new Vector2(width * 1.5f, 0), text, false, DebugTextures.GenerateRectangle(width, height, color), GUI.defaultFont, onPressed)); }