static void spawnRoundCactus(Squared.Tiled.Object obj) { GameObject2d enemy = GameObject2d.Initialize(); enemy.sprite = new Sprite(content.Load <Texture2D>("cactusRound")); //enemy.sprite.Scale *= 1; enemy.sprite.LayerDepth = 0.4f; enemy.addBehavior(new grazeEnemy()); enemy.addBehavior(new enemyHealth()); enemy.addBehavior(new BasicShootEnemy()); enemy.sprite.Position = new Vector2(obj.X, obj.Y); BulletSpawner b = new BulletSpawner(); b.bulletSpeed = 2; b.bulletAmount = 6; b.bulletfrequency = 0.5f; // ms b.spin = 0f; b.bulletSprite = content.Load <Texture2D>("needleBullet"); b.facing = true; b.scale = Vector2.One * 0.7f; enemy.addBehavior(b); }
static void spawnSun(Squared.Tiled.Object obj) { GameObject2d spawner = GameObject2d.Initialize(); //TEMP Texture2D bulletSprite = content.Load <Texture2D>("bullet_1"); spawner.sprite = new AnimatedSprite(content.Load <Texture2D>("sunSprite"), 3, 1000, 1000, true, 0); spawner.sprite.Scale *= 1; spawner.sprite.collisionBox *= 0.85f; spawner.sprite.LayerDepth = 0.4f; spawner.addBehavior(new grazeEnemy()); BulletSpawner b = new BulletSpawner(); spawner.sprite.Position = new Vector2(obj.X, obj.Y); b.bulletSpeed = 2; b.bulletAmount = 3; b.bulletfrequency = 0.05f; // ms b.spin = 0.3f; b.Wave = 0.2f; b.bulletSprite = bulletSprite; b.scale = Vector2.One * 0.4f; spawner.addBehavior(b); // Bar Vector2 barscale = Vector2.One * 0.29f; Vector2 barPos = new Vector2(300, 45); ProgressBar bar = ProgressBar.Initialize() as ProgressBar; bar.sprite = new Sprite(content.Load <Texture2D>("bar")); bar.sprite.Position = barPos; bar.sprite.Scale = barscale; bar.sprite.LayerDepth = 0.01f; bar.sprite.enableCam = false; bar.innerSprite = new Sprite(content.Load <Texture2D>("inner")); bar.innerSprite.Position = barPos; bar.innerSprite.Color = Color.DarkRed; bar.innerSprite.Scale = barscale; bar.innerSprite.enableCam = false; bar.value = 100; // more boss stuff? BossController boss = new BossController(); boss.healthbar = bar; spawner.addBehavior(boss); var h = new enemyHealth(); h.max = 20000; spawner.addBehavior(h); }
static void SwapMap(Squared.Tiled.Object obj) { fixForScreenSize(obj); string mapfilename = obj.Name + ".tmx"; Vector2 spawnLocation = fixForScreenSize(new Vector2(Int32.Parse(obj.Properties["playerLocationX"]), Int32.Parse(obj.Properties["playerLocationY"]))); void switchMap(PlayerObject p) => MainGameplayScreen.currentGame.loadMap(mapfilename, spawnLocation); GameObject2d g = GameObject2d.Initialize(); g.sprite.visible = false; g.addBehavior(new eventLocation(switchMap, new Vector2(obj.X, obj.Y), 32)); }
protected override void LoadContent() { // The testing for tilemaps map = Map.Load(Path.Combine(Content.RootDirectory, "TESTMAP.tmx"), Content); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); backgrounds = new SpriteBatch(GraphicsDevice); // Setting up render target PresentationParameters pp = graphics.GraphicsDevice.PresentationParameters; renderTarget = new RenderTarget2D(graphics.GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, SurfaceFormat.Color, DepthFormat.Depth24); // Load extra font = Content.Load <SpriteFont>("font"); zoom = Content.Load <Effect>("zoom"); background = Content.Load <Texture2D>("space"); //"p_u_r_p_b_o_y_s"); doggo = Content.Load <Texture2D>("DOGGIE"); //"p_u_r_p_b_o_y_s"); // Load sprites n stuff playerSpriteSheet = Content.Load <Texture2D>("explorer"); hitBoxSpriteSheet = Content.Load <Texture2D>("hitbox"); bulletSprite2 = Content.Load <Texture2D>("bullet_2"); bulletSprite = Content.Load <Texture2D>("bullet_1"); Texture2D mosueSprite = Content.Load <Texture2D>("mouse"); PlayerObject.CreatePlayer(JobInfo.Jobs[0], 0);//new Vector2(300, 700), playerSpriteSheet, hitBoxSpriteSheet, bulletSprite2, mosueSprite); // Oof PlayerObject.players.First().sprite.Position = new Vector2(1000, 1000); GameObject2d spawner = GameObject2d.Initialize(); spawner.sprite = new Sprite(bulletSprite); spawner.sprite.Scale *= 2; spawner.sprite.LayerDepth = 0.4f; spawner.addBehavior(new grazeEnemy()); BulletSpawner b = new BulletSpawner(); spawner.sprite.Position = new Vector2(300, 200); b.bulletSpeed = 2; b.bulletAmount = 3; b.bulletfrequency = 0.05f; // ms b.spin = 0.3f; b.Wave = 0.2f; b.bulletSprite = bulletSprite; b.scale = Vector2.One * 0.4f; spawner.addBehavior(b); // Bar Vector2 barscale = Vector2.One * 0.29f; Vector2 barPos = new Vector2(300, 45); ProgressBar bar = ProgressBar.Initialize() as ProgressBar; bar.sprite = new Sprite(Content.Load <Texture2D>("bar")); bar.sprite.Position = barPos; bar.sprite.Scale = barscale; bar.sprite.LayerDepth = 0.01f; bar.sprite.enableCam = false; bar.innerSprite = new Sprite(Content.Load <Texture2D>("inner")); bar.innerSprite.Position = barPos; bar.innerSprite.Color = Color.DarkRed; bar.innerSprite.Scale = barscale; bar.innerSprite.enableCam = false; bar.value = 100; // more boss stuff? BossController boss = new BossController(); boss.healthbar = bar; spawner.addBehavior(boss); spawner.addBehavior(new enemyHealth()); //init foreach (GameObject2d gameObject in GameObject2d.activeGameObjects) { gameObject.Start(); } }