public BasketballScene() { reset = false; Song bgm = Cloud.content.Load <Song>("Thats a Wrap"); MediaPlayer.Play(bgm); MediaPlayer.IsRepeating = true; sw.Start(); renderables = new RenderableCollection(); Physics.collisions = new CollisionHandler(renderables); toAdd = new List <Renderable>(); toRemove = new List <Renderable>(); Ball = new ball(new Vector2(120, 150), this); renderables.Add(Ball); TextureStatic.Load("hoopA", @"Art"); TextureStatic.Load("hoopB", @"Art"); TextureStatic.Load("courtBG", @"Art"); TextureStatic.Load("net", @"Art"); TextureStatic.Load("net2", @"Art"); //courtbg = new Background("court", @"Art\Backgrounds", new Vector2(-360, 110), new Vector2(-10, 0), 0.11f, true, this); //renderables.Add(courtbg); //tentacle tn = new tentacle(new Vector2(0, 0), this); //renderables.Add(tn); }
/// <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(); }
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(); }
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; }
/// <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(); 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 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> /// Loads all the shared and start/title/pause screen stuff. /// </summary> public static void LoadShared() { // Box art Textures TextureStatic.Load("BoxArtGame1", @"Shared\BoxArt\BoxArtGame1"); TextureStatic.Load("BoxArtGame2", @"Shared\BoxArt\BoxArtGame2"); TextureStatic.Load("BoxArtGame3", @"Shared\BoxArt\BoxArtGame3"); TextureStatic.Load("BoxArtGame4", @"Shared\BoxArt\BoxArtGame4"); TextureStatic.Load("BoxArtGame5", @"Shared\BoxArt\BoxArtGame5"); TextureStatic.Load("BoxArtHolder", @"Shared\BoxArt\BoxArtHolder"); // Other Shared Textures TextureStatic.Load("TitleNameBorder", @"Shared\Art\titleNameBorder"); TextureStatic.Load("Blank", @"Shared\Art\Blank"); TextureStatic.Load("tileSafeCheck", @"Shared\Art\tileSafeCheck"); TextureStatic.Load("particle1", @"DefaultBackground\particle1"); TextureStatic.Load("checkers", @"DefaultBackground\checkers"); TextureStatic.Load("colorSwirl", @"DefaultBackground\colorSwirl"); TextureStatic.Load("sampleInstructions", @"Shared\Art\sampleInstructions"); TextureStatic.Load("instructionBorder", @"Shared\Art\instructionBorder"); TextureStatic.Load("gradient", @"Shared\Art\Gradient"); // Audio GameWorld.audio.LoadSound("boxArtScroll", @"Shared\Sounds\boxArtScroll"); GameWorld.audio.LoadSound("menuClick", @"Shared\Sounds\menuClick"); GameWorld.audio.LoadSound("menuGoBack", @"Shared\Sounds\menuGoBack"); GameWorld.audio.LoadSound("menuScrollDown", @"Shared\Sounds\menuScrollDown"); GameWorld.audio.LoadSound("menuScrollUp", @"Shared\Sounds\menuScrollUp"); GameWorld.audio.LoadSound("volumeControlDown", @"Shared\Sounds\volumeControlDown"); GameWorld.audio.LoadSound("volumeControlUp", @"Shared\Sounds\volumeControlUp"); // Fonts FontStatic.Load("defaultFont", @"Shared\Fonts\defaultFont"); FontStatic.Load("controllerFont", @"Shared\Fonts\controllerFont"); }
/// <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); } }
/// <summary> /// Constructor /// </summary> /// <param name="name">Player's name</param> /// <param name="x">Spawn point X</param> /// <param name="y">Spawn point Y</param> public Player(ContentService content, ConfigurationService config, string name, float x, float y) { _config = config; _texture = content.TEXCharacter; Name = name; X = x; Y = y; CollisionBounds = new Rectangle(-75, -23, 134, 42); }
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 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; }
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"); }
// returns the set of bones used for the tentacle (sort of like a model) public static BoneSet GetBoneSet() { /* TODO: Complete this set */ BoneSet b = new BoneSet(); // Bone(Parent, Offset, Origin, Length, Width, Texture, Depth, [angle, color, alpha]) TextureStatic.Load("fArm", @"Art/body"); TextureStatic.Load("head1", @"Art/body"); TextureStatic.Load("lArm", @"Art/body"); TextureStatic.Load("lHand", @"Art/body"); TextureStatic.Load("lowerLeg", @"Art/body"); TextureStatic.Load("rArm", @"Art/body"); TextureStatic.Load("rHand", @"Art/body"); TextureStatic.Load("thigh", @"Art/body"); TextureStatic.Load("torso", @"Art/body"); float a = 0; //float b = 0; Bone torso = new Bone(null, Vector2.Zero, new Vector2(160, 53), 107, 230, "torso", -0.06f); Bone rThigh = new Bone(torso, new Vector2(-26, 30), new Vector2(10, 30), 58, 192, "thigh", 0.02f); Bone lThigh = new Bone(torso, new Vector2(27, 30), new Vector2(10, 30), 58, 192, "thigh", 0.02f); Bone rShin = new Bone(rThigh, new Vector2(-2, 100), new Vector2(18, 30), 110, 223, "lowerLeg", 0.02f); Bone lShin = new Bone(lThigh, new Vector2(-2, 100), new Vector2(18, 30), 110, 223, "lowerLeg", 0.02f); Bone lArm = new Bone(torso, new Vector2(-35, -116), new Vector2(10, 15), 35, 145, "rArm", 0.021f); Bone rArm = new Bone(torso, new Vector2(42, -116), new Vector2(10, 20), 35, 145, "lArm", 0.021f); Bone lFore = new Bone(lArm, new Vector2(0, 96), new Vector2(8, 12), 26, 137, "fArm", 0.0211f); Bone rFore = new Bone(rArm, new Vector2(0, 96), new Vector2(8, 12), 26, 137, "fArm", 0.0211f); Bone lHand = new Bone(lFore, new Vector2(-1, 90), new Vector2(3, 38), 65, 68, "lHand", 0.022f); Bone rHand = new Bone(rFore, new Vector2(-1, 90), new Vector2(3, 28), 65, 68, "rHand", 0.022f); //scale = .5f; Bone head = new Bone(torso, new Vector2(0, -154), new Vector2(5, 55), 103, 116, "head1", 0.02f); //Bone head = new Bone(torso, new Vector2(0 , -65), new Vector2(3.25f, 35.75f), 103 , 116 , "head1", 0.02f); b.AddBone(torso); b.AddBone(rThigh); b.AddBone(lThigh); b.AddBone(rShin); b.AddBone(lShin); b.AddBone(lArm); b.AddBone(rArm); b.AddBone(lFore); b.AddBone(rFore); b.AddBone(lHand); b.AddBone(rHand); b.AddBone(head); return(b); }
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); }
/// <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() { 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 titScene() { counter = 0; sw.Start(); TextureStatic.Load("logo3", @"Art/titleScreen"); TextureStatic.Load("bg", @"Art/titleScreen"); TextureStatic.Load("mark", @"Art/titleScreen"); TextureStatic.Load("pic1", @"Art/titleScreen"); TextureStatic.Load("pic2", @"Art/titleScreen"); TextureStatic.Load("pic3", @"Art/titleScreen"); Song bgm = Cloud.content.Load <Song>("The Whip Theme"); MediaPlayer.Play(bgm); MediaPlayer.IsRepeating = true; }
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); }
/// <summary> /// Loads app's content /// </summary> public override void LoadContent( ) { _fontBig = Content.Load <SpriteFont>(Path.Combine("Fonts", "Big")); _fontSmall = Content.Load <SpriteFont>(Path.Combine("Fonts", "Small")); _fontTiny = Content.Load <SpriteFont>(Path.Combine("Fonts", "Tiny")); _fontStandard = Content.Load <SpriteFont>(Path.Combine("Fonts", "Standard")); TEXCharacter = new TextureStatic(Content.Load <Texture2D>(Path.Combine("Textures", "Characters", "test_texture"))); TEXGround = new TextureStatic(Content.Load <Texture2D>(Path.Combine("Textures", "Ground", "tile_0"))); AUDIO_ButtonHover = Content.Load <SoundEffect>(Path.Combine("Audio", "UI", "button_menu")); AUDIO_Songs = new List <Tuple <GameMoodType, Song> >( ) { new Tuple <GameMoodType, Song>(GameMoodType.Default, Content.Load <Song>(Path.Combine("Audio", "Music", "song_0"))) }; }
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(); }