public Terminal(Vector2 position, World w, string t) : base(TextureStatic.Get("terminal"), PhysicsShape.Rectangle, position, w) { fixture.OnCollision += new OnCollisionEventHandler(OnCollision); fixture.OnSeparation += new OnSeparationEventHandler(OnSeparation); text = t; }
public void Draw() { Drawer.Draw( TextureStatic.Get("background"), Drawer.FullScreenRectangle, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0f); Drawer.DrawString( FontStatic.Get("defaultFont"), "Score: " + ScoreKeeper.score.ToString(), new Vector2(205, 205), Color.White, 0f, Vector2.Zero, 0.4f, SpriteEffects.None, 1f ); foreach (Entity e in m_Entities.Values) { e.Draw(); } }
/// <summary> /// Draws this instance. /// </summary> public override void Draw() { // Write "Paused" at the top-center of the background. Drawer.DrawOutlinedString( FontStatic.Get("defaultFont"), "Paused", this.position.Value + this.textDrawPosition, Color.White, 0f, this.textDrawOrigin, 1.2f, SpriteEffects.None, 0.99f); // Draw the frame Drawer.Draw( TextureStatic.Get("BoxArtHolder"), this.position.Value, null, Color.White, 0f, TextureStatic.GetOrigin("BoxArtHolder"), 1f, SpriteEffects.None, 0.3f); if (DateTime.Now.Ticks > this.drawLagTime) { this.menu.Draw(); } this.background.Draw(); }
/// <summary> /// Draws this instance. /// </summary> public override void Draw() { base.Draw(); Drawer.Draw( TextureStatic.Get("instructionBorder"), this.position.Value, null, Color.White, 0f, TextureStatic.GetOrigin("instructionBorder"), 1f, SpriteEffects.None, 0.4f); Drawer.Draw( TextureStatic.Get(this.imageName), this.position.Value, null, Color.White, 0f, TextureStatic.GetOrigin(this.imageName), 1f, SpriteEffects.None, 0.5f); }
public override void Draw() { base.Draw(); // Write "Super Power Robots" at the top-center of the background. Drawer.DrawOutlinedString( FontStatic.Get("defaultFont"), "", this.position.Value + this.textDrawPosition, Color.White, 0f, this.textDrawOrigin, 1f, SpriteEffects.None, 0.99f); // Draw the frame Drawer.Draw( TextureStatic.Get("BoxArtHolder"), this.position.Value, null, Color.White, 0f, TextureStatic.GetOrigin("BoxArtHolder"), 1f, SpriteEffects.None, 0.3f); this.menu.Draw(); }
/// <summary> /// Reference page contains code sample. /// </summary> /// <param name="gameTime">Time passed since the last call to Draw.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.White); spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend); ScreenContainer.LayerDepthStart = 0; ScreenContainer.LayerDepthEnd = 1; background.Draw(); screens.Draw(); #if DEBUG Drawer.Draw( TextureStatic.Get("tileSafeCheck"), Drawer.FullScreenRectangle, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 1.0f); #endif spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// Draws this instance. /// </summary> public override void Draw() { base.Draw(); this.background.Draw(); Drawer.Draw( TextureStatic.Get("instructionBorder"), this.position.Value, null, Color.White, 0f, TextureStatic.GetOrigin("instructionBorder"), 1f, SpriteEffects.None, 0.3f); if (this.viewport.Width > 0) { GameWorld.spriteBatch.End(); Viewport previousViewport = GameWorld.spriteBatch.GraphicsDevice.Viewport; GameWorld.spriteBatch.GraphicsDevice.Viewport = this.viewport; GameWorld.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend); Drawer.DrawOutlinedString( FontStatic.Get("defaultFont"), "Credits", this.position.Value + this.scrollPosition.Value, Color.White, 0f, this.titleOrigin, 1.3f, SpriteEffects.None, 0.8f); for (int i = 0; i < this.display.Count; i++) { // Only draw if it is going to be on the screen... Vector2 temp = this.position.Value + this.scrollPosition.Value + this.verticleSpacing[i]; if (temp.Y > -300 && temp.Y < 2220) { Drawer.DrawOutlinedString( FontStatic.Get("defaultFont"), this.display[i], temp, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); } } GameWorld.spriteBatch.End(); GameWorld.spriteBatch.GraphicsDevice.Viewport = previousViewport; GameWorld.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend); } }
public Bomb(Vector2 position, World world, Vector2 velocity) : base(position, world, TextureStatic.Get("bomb").Width, TextureStatic.Get("bomb").Height) { body.BodyType = BodyType.Dynamic; texture = TextureStatic.Get("bomb"); fixture = FixtureFactory.CreateCircle(TextureStatic.Get("bomb").Width / 2, 1, body); laidTime = GameClock.Now; world.AddBody(body); body.LinearVelocity = velocity; }
public Explosion(Vector2 position, World world, float radius, int power) : base(position, world, TextureStatic.Get("solitudeExplosion").Width, TextureStatic.Get("solitudeExplosion").Height) { body.BodyType = BodyType.Kinematic; body.Position = position; this.radius = 1f; maxRadius = radius; this.power = power; fixture = FixtureFactory.CreateCircle(this.maxRadius, 0f, body); fixture.CollisionFilter.CollidesWith = Category.None; texture = TextureStatic.Get("solitudeExplosion"); }
public Background(String asset, String directory, Vector2 pos, Vector2 vel, float dep, bool wr, Object par) { TextureStatic.Load(asset, directory); content = asset; position = pos; velocity = vel; parent = par; depth = dep; wrap = wr; width = TextureStatic.Get(asset).Width; halfwidth = width / 2; }
/// <summary> /// Draws this instance. /// </summary> public void Draw() { Drawer.Draw( TextureStatic.Get("checkers"), this.position, null, this.color, this.rotation, TextureStatic.GetOrigin("checkers"), 4f, SpriteEffects.None, this.layerDepth); }
public virtual void Draw() { Drawer.Draw(TextureStatic.Get(content), position, null, blend, rotation, origin, scale, flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, depth ); }
/// <summary> /// Draws the specified particle. /// </summary> /// <param name="particle">The particle.</param> public void Draw(Particle particle) { Drawer.Draw( TextureStatic.Get("particle3"), particle.Position, null, particle.color, particle.Rotation, TextureStatic.GetOrigin("particle3"), particle.Scale, SpriteEffects.None, 0.11f + 0.088f * (1f - (GameClock.Now - particle.CreationTime) / Duration)); }
public Mauler(Vector2 position, World w) : base(position, w, TextureStatic.Get("solitudeMauler").Width, TextureStatic.Get("solitudeMauler").Height) { health = Settings.maulerHealth; world = w; body.BodyType = BodyType.Dynamic; body.Position = position; texture = TextureStatic.Get("solitudeMauler"); fixture = FixtureFactory.CreateCircle(texture.Width / 2, 0.25f, body, Vector2.Zero); fixture.OnCollision += new OnCollisionEventHandler(OnCollision); world.AddBody(body); targetPoint = body.Position; }
public override void Draw() { Drawer.Draw( TextureStatic.Get(textureString), body.Position,//new Vector2(body.Position.X - width / 2, body.Position.Y - height / 2), drawRectangle, Color.White, body.Rotation, drawOrigin,//TextureStatic.GetOrigin("solitudeWallHandHold"), 1, SpriteEffects.None, .8f); }
public override void Draw() { base.Draw(); Drawer.Draw( TextureStatic.Get("winnerwinnerchickendinner"), new Rectangle(1920 / 2, 1080 / 2, 1520, 680), new Rectangle(0, 0, 1920, 1080), Color.White, 0f, new Vector2(1920 / 2, 1080 / 2), SpriteEffects.None, 0.5f); }
public Fighter(Vector2 position, World w) : base(position, w, TextureStatic.Get("fighter").Width, TextureStatic.Get("fighter").Height) { this.health = Settings.fighterHealth; world = w; lastShot = GameClock.Now; world = w; body.BodyType = BodyType.Dynamic; body.Position = position; texture = TextureStatic.Get("fighter"); fixture = FixtureFactory.CreateRectangle(texture.Width, texture.Height, 0.25f, Vector2.Zero, body); world.AddBody(body); targetPoint = body.Position; }
public override void Draw() { Rendering.Drawer.DrawRectangle(screenSize, 1920f, 0, Color.LightBlue); ship.Draw(); base.Draw(); Drawer.Draw(TextureStatic.Get("solitudeBorder"), borderOrigin, borderSource, Color.White, 0f, Vector2.Zero, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 1f); }
public TyTaylor(World w, Vector2 position) : base(position, w, TextureStatic.Get("ty").Width, TextureStatic.Get("ty").Height) { health = Settings.TyHealth; world = w; lastShot = GameClock.Now; body.BodyType = BodyType.Dynamic; body.Position = position; texture = TextureStatic.Get("ty"); fixture = FixtureFactory.CreateRectangle(texture.Width, texture.Height, 0.25f, Vector2.Zero, body); world.AddBody(body); targetPoint = body.Position; fixture.OnCollision += new OnCollisionEventHandler(this.OnCollision); }
public override void Draw() { Drawer.Draw(TextureStatic.Get(content), position, frameR, blend, rotation, origin, scale, flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, depth ); //Drawer.DrawRectangle(new Rectangle((int)(position.X - origin.X), (int)(position.Y - origin.Y), (int)dimensions.X, (int)dimensions.Y), 1.0f, depth - 0.01f, Color.Red); }
public void Draw() { foreach (Bone b in bones) { //if (b.Texture == "") continue; Drawer.Draw( TextureStatic.Get(b.Texture), b.Position + (Vector2.UnitY * yoffset), null, b.Blend, flip ? (float)Math.PI - b.Angle : b.Angle, flip ? new Vector2(b.Origin.X, b.Width - b.Origin.Y) : b.Origin, b.Scale, flip ? SpriteEffects.FlipVertically : SpriteEffects.None, this.depth + b.Depth); //Drawer.DrawLine(b.BoundingRect[0], b.BoundingRect[1], 1.0f, 1.0f, Color.Orange); //Drawer.DrawLine(b.BoundingRect[1], b.BoundingRect[2], 1.0f, 1.0f, Color.Orange); //Drawer.DrawLine(b.BoundingRect[2], b.BoundingRect[3], 1.0f, 1.0f, Color.Orange); //Drawer.DrawLine(b.BoundingRect[3], b.BoundingRect[0], 1.0f, 1.0f, Color.Orange); //Drawer.DrawRectangle(Collision2D.BoundingRectangle(b.BoundingRect), 1.0f, 1.0f, Color.Yellow * 0.5f); //List<Vector2> tri1 = Collision2D.TriangleFromRectangle(b.BoundingRect, true); //List<Vector2> tri2 = Collision2D.TriangleFromRectangle(b.BoundingRect, false); //for (int i = 0; i < 3; i++) //{ // Drawer.DrawLine(tri1[i], tri1[(i + 1) % 3], 1.0f, 1.0f, Color.Pink); //} //for (int i = 0; i < 3; i++) //{ // Drawer.DrawLine(tri2[i], tri2[(i + 1) % 3], 1.0f, 1.0f, Color.Pink); //} } /*Drawer.DrawString( * FontStatic.Get("defaultFont"), * progress.ToString(), * this.Origin, * Color.White, * 0f, * Vector2.Zero, * 1.0f, * SpriteEffects.None, * 0.9f);*/ }
/// <summary> /// Draws this instance. /// </summary> public void Draw() { Drawer.Draw( TextureStatic.Get("gradient"), this.DisplayRectangle, null, Color.Blue, 0f, Vector2.Zero, SpriteEffects.None, this.layerDepth); foreach (Hypercube hypercube in this.hypercubes) { hypercube.Draw(); } }
public Sentinel(Vector2 position, Vector2 velocity, World w, int rate) : base(position, w, TextureStatic.Get("sentinel").Width, TextureStatic.Get("sentinel").Height) { health = Settings.sentinelHealth; patrolRate = rate; lastShot = GameClock.Now; lastTurn = lastShot; world = w; body.BodyType = BodyType.Dynamic; speed = velocity; body.LinearVelocity = velocity; //body.Position = position; texture = TextureStatic.Get("sentinel"); fixture = FixtureFactory.CreateRectangle(texture.Width, texture.Height, 0.25f, Vector2.Zero, body); world.AddBody(body); }
public Player(Vector2 position, World world) : base(position, world, (float)Player.width, (float)Player.height) { body.BodyType = BodyType.Dynamic; PlayerFixture = FixtureFactory.CreateEllipse(width / 2, height / 2, 32, .2f, body); //PlayerFixture = FixtureFactory.CreateRectangle(width, height, .05f, Vector2.Zero, body, null); PlayerFixture.Restitution = .8f; texture = TextureStatic.Get("solitudePlayer"); enterPosition = new Vector2(900, 830); Reset(); hpBar = new HealthBar(oxygen, oxygenCap); fBar = new FuelBar(fuel, fuelCap); //lCnt = new LivesCount(); }
public void Update(float dTime) { m_Time += dTime; if (m_reloading > 0) { m_reloading -= dTime; } if (this.m_firing && weaponType == WeaponType.gun) { Body tempBody = BodyFactory.CreateBody(m_SPRWorld.World); tempBody.BodyType = BodyType.Dynamic; tempBody.IsBullet = true; float rotation = this.GetAbsRotation(); tempBody.Position = this.GetAbsPosition() + 45 * Settings.MetersPerPixel * (new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation))); tempBody.SetTransform(tempBody.Position, 0); Fixture f = FixtureFactory.CreateCircle(4 * Settings.MetersPerPixel, 1f, tempBody); f.OnCollision += Projectile.OnBulletHit; Vector2 initialVelocity = new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)) / 10; Projectile justFired = new Projectile(m_SPRWorld, tempBody, TextureStatic.Get("Projectile"), initialVelocity, this.GetAbsRotation(), 5, 5 * Settings.MetersPerPixel, 5 * Settings.MetersPerPixel, m_power, 1); f.UserData = justFired; this.m_SPRWorld.AddEntity(justFired); this.m_firing = false; } if (!this.m_firing && weaponType == WeaponType.melee) { m_AxeJoint.MotorSpeed = 0; } if (this.m_firing && weaponType == WeaponType.melee) { m_AxeJoint.MotorSpeed = (float)Math.Cos(m_Time * 10) * 10; this.m_firing = false; } // Similar to Entity.Update() if (this.m_health <= 0f) { this.m_owner.RemoveWeapon(this); } this.m_SPRWorld.World.ProcessChanges(); }
/// <summary> /// Draws this instance. /// </summary> public void Draw() { Drawer.Draw( TextureStatic.Get("titleNameBorder"), this.titleBorderPosition, null, Color.White, 0f, TextureStatic.GetOrigin("titleNameBorder"), 1f, SpriteEffects.None, 0.97f); this.background.Draw(); this.titleString.Draw(); this.descriptionString.Draw(); this.aAndXButtonDisplay.Draw(); }
/// <summary> /// The origins of each image, for quick reference. /// </summary> /// <param name="asset">The name of the asset you want to use.</param> /// <param name="directory">The directory containing the asset.</param> public Sprite(String asset, String directory, Vector2 pos, Vector2 org, Object parentObj) { TextureStatic.Load(asset, directory); position = pos; origin = org; depth = 1.0f; flip = false; blend = Color.White; rotation = 0.0f; scale = 1.0f; content = asset; parent = parentObj; Texture2D t = TextureStatic.Get(asset); dimensions = new Vector2(t.Width, t.Height); bounding = dimensions; bposition = origin; }
/// <summary> /// Draws this instance. /// </summary> public virtual void Draw() { if (!string.IsNullOrEmpty(this.Info.BoxArt)) { Drawer.Draw( TextureStatic.Get("BoxArtHolder"), this.Position.Value, null, Color.White, 0f, TextureStatic.GetOrigin("BoxArtHolder"), 1f, SpriteEffects.None, this.LayerDepth - 0.04f); Drawer.Draw( TextureStatic.Get(this.Info.BoxArt), this.Position.Value, null, Color.White, 0f, TextureStatic.GetOrigin(this.Info.BoxArt), 1f, SpriteEffects.None, this.LayerDepth); } else { Drawer.Draw( TextureStatic.Get("BoxArtHolder"), this.Position.Value, null, Color.White, 0f, TextureStatic.GetOrigin("BoxArtHolder"), 1f, SpriteEffects.None, this.LayerDepth + 0.04f); this.background.Draw(); } }
/// <summary> /// Draws this instance. /// </summary> public override void Draw() { Drawer.Draw( TextureStatic.Get("colorSwirl"), this.backgroundDrawLocation, null, Color.White, this.backgroundDrawRotation, TextureStatic.GetOrigin("colorSwirl"), 4f, SpriteEffects.None, 0f); foreach (RandomColorEffect effect in this.effects) { effect.Draw(); } base.Draw(); }
public void Draw() { position += velocity; if (position.X < Camera2D.cam.Pos.X - halfwidth && wrap) { position = new Vector2(Camera2D.cam.Pos.X + halfwidth, position.Y); } if (wrap) { int bgnum = (int)Math.Ceiling((Cloud.screenWidth * (1 / Camera2D.cam.Zoom)) / width); int bgnumhalf = bgnum / 2; for (int i = -bgnumhalf - 1; i < bgnumhalf + 1; i++) { Drawer.Draw(TextureStatic.Get(content), position + new Vector2(width * i, 0), null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, depth ); } } else { Drawer.Draw(TextureStatic.Get(content), position, null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, depth ); } }