public Mine(Vector2 pos, Bibble owner, Texture2D tex, Game g) : base(tex, pos, g) { this.owner = owner; if (owner != null) { this.OuterRadius = owner.MineOuterRadius; this.InnerDamage = owner.MineDamage; } }
public override bool Collide(Collidable c) { if (c is Bibble) { Bibble b = (Bibble) c; if (b.IsDead || Owner == b) return false; b.Damage(Damage); BibbleGame g = Game as BibbleGame; if (g != null) g.Explosion(Position, 0.1f, false); return true; } else // bounce of, if stil bouncing { mRebounds--; Owner = null; } return mRebounds < 0; }
public Bullet(Game g, Bibble owner, Vector2 pos, float orient, float speed) : base(g, BibbleGame.Statics.BulletTex, pos, orient, speed, 0.1f) { this.Owner = owner; this.mDamage = owner.BulletDamage; }
private void drawBib(Bibble bib, GameTime gt) { if (bib.IsDead) { spriteBatch.DrawString(fontHuge, ((int)(bib.SpawnMS / 1000 + 1)).ToString(), new Vector2(300, 300), bib.Color); return; } int screenWidth = Window.ClientBounds.Width, screenHeight = Window.ClientBounds.Height; if (bib.IsInside(new Rectangle(0, 0, screenWidth, screenHeight))) { //Vector2 paintCorner = PaintCorner(bib.Width, bib.Height, bib.Orientation, bib.Position); //spriteBatch.Draw(Statics.BibbleTex, bib.PaintCorner, Statics.BibbleTex.Bounds, bib.Color, bib.Orientation, new Vector2(0, 0), 1, SpriteEffects.None, 0); bib.Draw(gt); /* // Red DOT for paintcorner debug Texture2D dummyTexture = new Texture2D(GraphicsDevice, 3, 3); dummyTexture.SetData(new Color[] { Color.Red, Color.Red, Color.Red, Color.Red, Color.Black, Color.Red, Color.Red, Color.Red, Color.Red }); spriteBatch.Draw(dummyTexture, bib.PaintCorner - new Vector2(1, 1), Color.Red); */ } else { Vector2 position = bib.Position; if (position.X < 0) position.X = 25; if (position.X > screenWidth) position.X = screenWidth - 25; if (position.Y < 0) position.Y = 25; if (position.Y > screenHeight) position.Y = screenHeight - 25; float thumbFactor = (float) (3 / Math.Log(Vector2.Distance(position, bib.Position))); position = PaintCorner((int)(bib.Width * thumbFactor), (int)(bib.Height * thumbFactor), bib.Orientation + (float)Math.PI/2f, position); spriteBatch.Draw(Statics.BibbleTex, position, Statics.BibbleTex.Bounds, bib.Color, bib.Orientation + (float)Math.PI / 2f, new Vector2(0, 0), bib.Zoom * thumbFactor, SpriteEffects.None, 0); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); bib1 = new Bibble(this, Statics.BibbleTex); bib1.Zoom = 60f / Statics.BibbleTex.Width; Color c = Color.Purple; c.A = 0x6F; bib2 = new Bibble(this, Statics.BibbleTex, c); bib2.Zoom = 60f / Statics.BibbleTex.Width; //TODO: list of all damageable objects bibbles = new List<Bibble>(); bibbles.Add(bib1); bibbles.Add(bib2); this.Components.Add(new ItemSpawner(this, 30000)); }