/// <summary> /// Creates a TBBall at starting_offset, given some direction given by angle /// </summary> /// <param name="angle">Determines direction ball is fired off at, 0 == straight up, 180degrees = straight down, etc</param> /// <param name="starting_offset">Initial position of ball</param> public TBBall(float angle, Vector2 starting_offset) { /* given some angle, we will generate our position as a rotation * from the starting location */ float temp_radius = 1.0f; Position = starting_offset; owner = OWNER.NONE; overlay = new RectangleOverlay(new Rectangle((int)Position.X, (int)Position.Y, (int)(128.0f * .3), (int)(128.0F * .3)), Color.Green, Arena.Screens.TrailBlazer.gDevice); /* maybe we can choose random between -1 and 1 for both x and y, then normalize? */ //float x = Utility.MathFunctions.RandomFromRange(-1.0f, 1.0f, r); //float y = Utility.MathFunctions.RandomFromRange(-1.0f, 1.0f, r); //direction = new Vector2(x, y); //direction.Normalize(); var angl = r.NextDouble() * Math.PI * 2.0f; direction = new Vector2((float)Math.Cos(angl), (float)Math.Sin(angl)); direction.Normalize(); particle_effect_id = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("BallOfLight", Screens.TrailBlazer.content); /* One "glitch" from the particle engine is the first update will be wonky due to Interpolation * between LastLocation and Location, so we will fix that by setting both Location and LastLocation to starting_offset * difference is negligble, but let's be thorough */ ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.Location = starting_offset; ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.LastLocation = starting_offset; /* Finally, we need to start generating particles asap */ ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Generating = true; }
public override void Initialize() { base.Initialize(); backbox = new RectangleOverlay(Manager.Graphics.ScreenBounds); backbox.BackColor = new Color(0, 0, 0, 0.8f); backbox.ForeColor = new Color(0, 0, 0, 0.8f); backbox.Fixed = true; }
public RunNJumpObstacle(Texture2D texture, Rectangle? src_rectangle, Vector2 position, float scale, GraphicsDevice gDevice) : base(texture, src_rectangle, position, scale) { Velocity = new Vector2(-1, 0); Speed = 800.0f; obstacle_rect = new RectangleOverlay(BoundingRectangle, Color.Green, gDevice); ColorData = new Color[texture.Width * texture.Height]; texture.GetData(ColorData); }
private void DrawRectangle(RectangleOverlay overlay) { var ul = ToActualPoint(overlay.UpperLeft); var br = ToActualPoint(overlay.BottomRight); OverlayBitmap.DrawRectangle((int)ul.X, (int)ul.Y, (int)br.X, (int)br.Y, overlay.BorderColor); if (overlay.FillColor != null) { OverlayBitmap.FillRectangle((int)ul.X, (int)ul.Y, (int)br.X, (int)br.Y, overlay.FillColor); } }
public TankProjectile(Vector2 pos, Vector2 velocity, PlayerIndex owner) { this.owner = owner; radius = 1f; position = pos; this.velocity = velocity; this.projectile_id = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("FireBall", Arena.Screens.TankShooters.content); ArenaParticleEngine.ParticleEngine.Instance.systems[projectile_id].effects[0].Generating = true; this.smoke_id = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("SmokeTrail", Arena.Screens.TankShooters.content); ArenaParticleEngine.ParticleEngine.Instance.systems[smoke_id].effects[0].Generating = true; overlay = new RectangleOverlay(Rectangle.Empty, Color.White, Arena.Screens.TankShooters.gDevice); }
public TBBall(Vector2 direction_override, Vector2 start) { Position = start; direction = direction_override; owner = OWNER.NONE; overlay = new RectangleOverlay(new Rectangle((int)Position.X, (int)Position.Y, (int)(128.0f * .3), (int)(128.0F * .3)), Color.Green, Arena.Screens.TrailBlazer.gDevice); particle_effect_id = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("BallOfLight", Screens.TrailBlazer.content); ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.Location = start; ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.LastLocation = start; /* Finally, we need to start generating particles asap */ ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Generating = true; }
public Body(World World) { this.Id = Guid.NewGuid(); this.World = World; this.box = new RectangleOverlay(); this.Enabled = true; this.Bounds = Rectangle.Empty; this.Weight = 0; this.Fixed = true; this.Force = Vector2.Zero; this.Trigger = false; this.Z = 0; this.ZDiscard = false; }
public Tank(Texture2D tbt, Texture2D tct, Texture2D tbtr) { health = new UI.HealthBar(50, 50); health.Scale = .6f; tank_body_texture = tbt; tank_cannon_texture = tct; tank_body_texture_right = tbtr; tank_body_to_draw = tank_body_texture; Position = new Vector2(300, 400); Orientation = SpriteEffects.None; debug_overlay = new RectangleOverlay(CollisionRect, Color.Green, Arena.Screens.TankShooters.gDevice); tank_dust_effect = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("TankDustEffect", Arena.Screens.TankShooters.content); }
public override void Initialize() { base.Initialize(); enemyBox = new RectangleOverlay(new Rectangle(0, 0, 32, 32)); enemyBox.Visible = false; // Creamos una instancia del motor de animaciones de enemigos: enemy = new EnemyAnimationEngine("enemy"); // Cargamos la textura que hara de escudo si la particula es invencible y la configuramos: shield = new Sprite(Manager.Graphics.LoadTexture("enemy_shield")); shield.Animations.AddSecuence("default", new Rectangle(0, 0, 48, 48), 2, 1250, true); shield.Animations.Play("default"); shield.Center = true; shield.Visible = false; shield.Enabled = false; this.Bounds = enemyBox.Bounds; box = new Body(Manager.PhysicEngine, this.Bounds, 1, true); box.OnCollision += this.OnCollision; Manager.PhysicEngine.Bodies.Add(box); this.Tag = "enemy"; this.Invincible = false; this.IsDead = false; this.IsReady = false; this.respawnTimer = new Timer(); this.respawnTime = 0; this.invincibleTimer = new Timer(); this.invincibleTime = 0; this.ZOrder = -1; }
public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); int ninja_slide_effect_name = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("SlidingDirt", content); spriteBatch = new SpriteBatch(ScreenManager.GraphicsDevice); test = content.Load<Texture2D>(@"blackbox"); rect = new RectangleOverlay(new Rectangle(10, 10, 100, 100), Color.Green, ScreenManager.GraphicsDevice); //List<Texture2D> dirt_textures = new List<Texture2D>(); //dirt_textures.Add(ScreenManager.Game.Content.Load<Texture2D>(@"ParticleTextures\Dirt2")); //particleEngine = new ParticleEngine.ParticleEngine(dirt_textures, new Vector2(400, 240)); test_alpha = content.Load<Texture2D>(@"obstacle_alpha"); //test_obstacle = new RunNJumpObstacle(content.Load<Texture2D>(@"obstacle_alpha"), null, new Vector2(300, 300), 2.0f); _game_map = new RunNJumpMap(content.Load<Texture2D>(@"MapTiles\DirtTile"), content.Load<Texture2D>(@"MapTiles\GrassTile"), content.Load<Texture2D>(@"obstacle_alpha"), ScreenManager.GraphicsDevice); _game_background = content.Load<Texture2D>(@"sky1"); font = content.Load<SpriteFont>(@"SpriteFont1"); gameFont = content.Load<SpriteFont>(@"GameStateFont"); //player = new Players.RunNJumpPlayer(PlayerIndex.One, ScreenManager.Game.Content.Load<Texture2D>(@"blue_ninja_new"), // _game_map.GroundY - (int)(64 * 2.0f), ScreenManager.Game.Content.Load<Texture2D>(@"ParticleTextures\Dirt3"), ScreenManager.GraphicsDevice); //test_sprite = new RunNJumpNinja(content.Load<Texture2D>(@"blue_ninja_new"), new Rectangle(0, 0, 64, 64), new Vector2(100, _game_map.GroundY - (64 * 2.0f)), 2.0f, 0, 4, .08f, new Point(64, 64), ScreenManager.Game.Content.Load<Texture2D>(@"ParticleTextures\Dirt3"), ScreenManager.GraphicsDevice); foreach (PlayerIndex PI in PlayerIndexes) { _players.Add(new RunNJumpPlayer(PI, content.Load<Texture2D>(@"blue_ninja_new"), _game_map.GroundY - (int)(64 * 2.0f), ninja_slide_effect_name, ScreenManager.GraphicsDevice)); } ScreenManager.Game.ResetElapsedTime(); }
public override void Initialize() { base.Initialize(); back = new RectangleOverlay(Manager.Graphics.ScreenBounds); back.BackColor = new Color(0, 0, 0, 0.85f); back.Fixed = true; // Esquema del gamepad de XBox360: gameInput = new Sprite(Manager.Graphics.LoadTexture(@"GameUI\Options\pad_menu")); gameInput.Center = true; gameInput.Location = Helper.PointToVector2(Manager.Graphics.ScreenBounds.Center); gameInput.Fixed = true; // Textos de ayuda: Label label; labels = new List <Label>(); label = new Label(); labels.Add(label); Manager.Scene.AddEntity(label); label.SmallFont = true; label.Caption = Session.Strings["gamepad_pause"]; label.Location = new Vector2(300, 200); label.Center = true; label.ZOrder = -999999908; label = new Label(); labels.Add(label); Manager.Scene.AddEntity(label); label.SmallFont = true; label.Caption = Session.Strings["gamepad_move"]; label.Location = new Vector2(300, 320); label.Center = true; label.ZOrder = -999999908; label = new Label(); labels.Add(label); Manager.Scene.AddEntity(label); label.SmallFont = true; label.Caption = Session.Strings["gamepad_crouch"]; label.Location = new Vector2(300, 516); label.Center = true; label.ZOrder = -999999908; label = new Label(); labels.Add(label); Manager.Scene.AddEntity(label); label.SmallFont = true; label.Caption = Session.Strings["gamepad_weapon"]; label.Location = new Vector2(955, 204); label.Center = true; label.ZOrder = -999999908; label = new Label(); labels.Add(label); Manager.Scene.AddEntity(label); label.SmallFont = true; label.Caption = Session.Strings["gamepad_jump"]; label.Location = new Vector2(955, 320); label.Center = true; label.ZOrder = -999999908; label = new Label(); labels.Add(label); Manager.Scene.AddEntity(label); label.SmallFont = true; label.Caption = Session.Strings["gamepad_shoot"]; label.Location = new Vector2(955, 516); label.Center = true; label.ZOrder = -999999908; // Pistas: inputHint = new InputHintLabel(); Manager.Scene.AddEntity(inputHint); inputHint.Button = InputHintLabel.GamepadButtonChar.B; inputHint.Caption = Session.Strings["button_back"]; inputHint.Location = new Vector2(Manager.Graphics.ScreenBounds.Center.X - 40, Manager.Graphics.ScreenSafeArea.Bottom - 14); inputHint.ZOrder = -999999908; base.ZOrder = -999999907; }
public override void Initialize() { base.Initialize(); captions = new List <string>(); captions.Add(@" {0} "); captions.Add(@" {0} "); captions.Add(@"/ {0} \"); captions.Add(@"// {0} \\"); captions.Add(@"/// {0} \\\"); captions.Add(@" /// {0} \\\ "); captions.Add(@" /// {0} \\\ "); captions.Add(@" /// {0} \\\ "); captions.Add(@" /// {0} \\\ "); captions.Add(@" /// {0} \\\ "); captions.Add(@" /// {0} \\\ "); captions.Add(@" // {0} \\ "); captions.Add(@" / {0} \ "); captions.Add(@" {0} "); captions.Add(@" /// {0} \\\ "); captions.Add(@" {0} "); captions.Add(@" /// {0} \\\ "); captions.Add(@" {0} "); captions.Add(@"/ {1} \"); captions.Add(@" {1} "); captions.Add(@" {1} "); captions.Add(@"// {1} \\"); captions.Add(@"/// {1} \\\"); captions.Add(@" /// {1} \\\ "); captions.Add(@" /// {1} \\\ "); captions.Add(@" // {1} \\ "); captions.Add(@" / {1} \ "); captions.Add(@" {1} "); captions.Add(@" {1} "); captions.Add(@" {1} "); captions.Add(@" /// {1} \\\ "); captions.Add(@" {1} "); captions.Add(@" /// {1} \\\ "); captions.Add(@" {1} "); //captions.Add(@" WARNING "); //captions.Add(@" WARNING "); //captions.Add(@"/ WARNING \"); //captions.Add(@"// WARNING \\"); //captions.Add(@"/// WARNING \\\"); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" // WARNING \\ "); //captions.Add(@" / WARNING \ "); //captions.Add(@" WARNING "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" WARNING "); //captions.Add(@" /// WARNING \\\ "); //captions.Add(@" WARNING "); //captions.Add(@"/ CONDITION ALERT \"); //captions.Add(@" CONDITION ALERT "); //captions.Add(@" CONDITION ALERT "); //captions.Add(@"// CONDITION ALERT \\"); //captions.Add(@"/// CONDITION ALERT \\\"); //captions.Add(@" /// CONDITION ALERT \\\ "); //captions.Add(@" /// CONDITION ALERT \\\ "); //captions.Add(@" // CONDITION ALERT \\ "); //captions.Add(@" / CONDITION ALERT \ "); //captions.Add(@" CONDITION ALERT "); //captions.Add(@" CONDITION ALERT "); //captions.Add(@" CONDITION ALERT "); //captions.Add(@" /// CONDITION ALERT \\\ "); //captions.Add(@" CONDITION ALERT "); //captions.Add(@" /// CONDITION ALERT \\\ "); //captions.Add(@" CONDITION ALERT "); redBox = new RectangleOverlay(Manager.Graphics.ScreenBounds); redBox.BackColor = Color.Red; redBox.ForeColor = Color.Red; redBox.Fixed = true; alpha = 1; maxAlpha = 1; flag = 0; warning = new Label(); warning.Initialize(); warning.Center = true; warning.Scale = 2; warning.Location = Helper.PointToVector2(Manager.Graphics.ScreenBounds.Center); i = 0; loops = 0; disable = false; timer = new Timer(); base.ZOrder = -999999999; }