/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Centipede game = new Centipede()) { game.Run(); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); centipedeSpriteSheet = Content.Load <Texture2D>("Arcade - Centipede - General Sprites"); player = new Player(centipedeSpriteSheet, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); centipede = new Centipede(centipedeSpriteSheet, 3, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, mushrooms); font1 = Content.Load <SpriteFont>("SpriteFont1"); text = new Vector2(GraphicsDevice.Viewport.Width / 2 - font1.MeasureString(restartMessage).X / 2, GraphicsDevice.Viewport.Height / 2 - font1.MeasureString(restartMessage).Y / 2); //spider = new Spider(graphics, spriteSheet); }
public bool centipedeProj(Centipede c) {//calculates relationship between a speffic centipede and the ships projectile for (int segment = 0; segment < c.body.Length; segment++) { if (c.body[segment].position.Intersects(player.proj)) { score += 1; if (c.body.Length > 1) { level.mushrooms[(c.body[segment].position.X / 20) - 1, ((c.body[segment].position.Y - 40) / 20) - 2].visible = true; } newCentipede(c.hit(segment)); return(false); } } return(true); }
public bool centipedeCollision(Centipede centipede, GameTime gameTime) {//This works I think but is kinda weird and finicky on relative positioning CentipedeSegment head = centipede.body[0]; foreach (Mushroom m in level.mushrooms) { if (!centipede.recentBounce && head.position.Intersects(m.loc) && m.visible) { if (head.velocity > 0) { centipede.addTurn(new Vector2(m.loc.X - 20, m.loc.Y), gameTime); centipede.body[0].position.X -= head.velocity; } else if (head.velocity < 0) { centipede.addTurn(new Vector2(m.loc.X + 20, m.loc.Y), gameTime); centipede.body[0].position.X -= head.velocity; } centipede.body[0].turn(); return(false); } } return(true); }
static void Main(string[] args) { if (args.Length <= 0) { PrintUsage(); return; } var path = Path.GetFullPath(args.Length > 0 ? args[0].Replace("\"", "") : "./ "); Console.WriteLine($"Processing files under {path} ... "); _centipedeInstance = new Centipede(new ConsoleLogger(), path); Console.WriteLine("Done"); if (args.Length == 1) { StartInteractiveMode(); } else { StartBatchMode(args.Skip(1)); } }
static void Main() { using (var game = new Centipede()) game.Run(); }