{"id":14403,"date":"2022-10-07T17:34:02","date_gmt":"2022-10-07T12:04:02","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/"},"modified":"2022-10-07T17:34:02","modified_gmt":"2022-10-07T12:04:02","slug":"solved-shooting-collision-of-the-shot-with-a-collection-of-list","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/","title":{"rendered":"[Solved] Shooting. Collision of the shot with a collection of List"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-52144996\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"52144996\" data-parentid=\"52138460\" data-score=\"1\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Without claiming to rework your design, I added collection of dead invaders(<code>ArmyOfInvaders.deadInvader<\/code>) to stored those ones, who already shot, and changed <code>InvaderGotShot<\/code> and <code>DrawItem<\/code> methods. I got rid of <code>Invader.invader<\/code> collection and introduced local variable in <code>Invader.InitializeInvader<\/code> instead of it to prevent misassigning. Please take a look:<\/p>\n<pre><code>class Program\n{\n\n    static void Main()\n    {\n        Settings.ScreenSettings();\n        ArmyOfInvaders.InitializeArmyOfInvaders();\n        Player.InitializePlayer();\n        int stepCount = 0;\n        int armyOfInvadersSpeed = 50;\n        while (true)\n        {\n            stepCount++;\n\n            if (stepCount % armyOfInvadersSpeed == 0)\n            {\n                Draw.EraseItem(ArmyOfInvaders.armyOfInvaders);\n\n                ArmyOfInvaders.armyOfInvaders.Clear();\n                ArmyOfInvaders.InitializeArmyOfInvaders(Movement.moveY, Movement.moveX);\n\n                Movement.MovementArmyOfInvaders();\n                stepCount = 0;\n            }\n            Console.CursorVisible = false;\n            Draw.DrawItem(ArmyOfInvaders.armyOfInvaders);\n            Draw.EraseItem(Player.player);\n            Shoot.GenerateShot();\n\n            Movement.MovementPlayer();\n            Draw.DrawItem(Player.player);\n            Draw.DrawShoot();\n            Draw.EraseShoot();\n            Collision.InvaderGotShot();\n\n            Thread.Sleep(Common.gameSpeed);\n\n        }\n\n    }\n\n}\npublic class Settings\n{\n    static public int maxRows = 50;\n    static public int maxCols = 180;\n    public static void ScreenSettings()\n    {\n        Console.CursorVisible = false;\n        Console.BufferHeight = Console.WindowHeight = maxRows;\n        Console.BufferWidth = Console.WindowWidth = maxCols;\n    }\n}\npublic struct Position\n{\n    public int Row { get; set; }\n    public int Col { get; set; }\n    public char Symbol { get; set; }\n\n    public Position(int row, int col, char symbol)\n    {\n        this.Row = row;\n        this.Col = col;\n        this.Symbol = symbol;\n    }\n}\npublic class Player\n{\n    public static List&lt;Position&gt; player = new List&lt;Position&gt;();\n    public static int playerWide = 9;\n    public static int playerLong = player.Count;\n\n    public static List&lt;Position&gt; InitializePlayer(int row = 0, int col = 0)\n    {\n\n\n        int startrow = Settings.maxRows - 5 - playerLong;\/\/start position row\n        int startcol = (Settings.maxCols \/ 2) - (playerWide \/ 2);\/\/ start position col\n\n        player.Add(new Position(startrow + row, startcol + col, 'A'));\n        player.Add(new Position(startrow + 1 + row, startcol + col, 'o'));\n        player.Add(new Position(startrow + 2 + row, startcol - 2 + col, '|'));\n        player.Add(new Position(startrow + 2 + row, startcol + col, 'o'));\n        player.Add(new Position(startrow + 2 + row, startcol + 2 + col, '|'));\n        player.Add(new Position(startrow + 3 + row, startcol - 4 + col, \"https:\/\/stackoverflow.com\/\"));\n        player.Add(new Position(startrow + 3 + row, startcol - 3 + col, '\\\\'));\n        player.Add(new Position(startrow + 3 + row, startcol - 2 + col, '\\\\'));\n        player.Add(new Position(startrow + 3 + row, startcol - 1 + col, '\\\\'));\n        player.Add(new Position(startrow + 3 + row, startcol + col, 'o'));\n        player.Add(new Position(startrow + 3 + row, startcol + 1 + col, \"https:\/\/stackoverflow.com\/\"));\n        player.Add(new Position(startrow + 3 + row, startcol + 2 + col, \"https:\/\/stackoverflow.com\/\"));\n        player.Add(new Position(startrow + 3 + row, startcol + 3 + col, \"https:\/\/stackoverflow.com\/\"));\n        player.Add(new Position(startrow + 3 + row, startcol + 4 + col, '\\\\'));\n        player.Add(new Position(startrow + 4 + row, startcol - 2 + col, '&lt;'));\n        player.Add(new Position(startrow + 4 + row, startcol - 1 + col, \"https:\/\/stackoverflow.com\/\"));\n        player.Add(new Position(startrow + 4 + row, startcol - 0 + col, 'o'));\n        player.Add(new Position(startrow + 4 + row, startcol + 1 + col, '\\\\'));\n        player.Add(new Position(startrow + 4 + row, startcol + 2 + col, '&gt;'));\n        return player;\n    }\n}\npublic class Movement\n{\n    public static bool isRight = true;\n\n    public static int moveX = 0;\n    public static int moveY = 0;\n    public static int left = -1;\n    public static int right = 1;\n    public static int armyOfInvaderJump = 5;\n    public static void MovementArmyOfInvaders()\n    {\n\n\n        if (isRight)\n        {\n            moveX += armyOfInvaderJump;\n            if (ArmyOfInvaders.armyOfInvaders[ArmyOfInvaders.armyOfInvaders.Count - 1][9].Col &gt;= Settings.maxCols - 20)\n            {\n                isRight = false;\n                moveY += 2;\n            }\n        }\n        else\n        {\n            moveX -= armyOfInvaderJump;\n            if (ArmyOfInvaders.armyOfInvaders[0][0].Col &lt;= 20)\n            {\n                isRight = true;\n                moveY += 2;\n            }\n        }\n    }\n\n    public static void MovementPlayer()\n    {\n\n\n        while (Console.KeyAvailable)\n        {\n            ConsoleKeyInfo key = Console.ReadKey(true);\n            while (Console.KeyAvailable)\n            {\n                Console.ReadKey(true);\n            }\n            if (Player.player[0].Col - 6 &gt;= 0)\n            {\n                if (key.Key == ConsoleKey.LeftArrow)\n                {\n                    for (int i = 0; i &lt; Player.player.Count; i++)\n                    {\n                        Player.player[i] = new Position(Player.player[i].Row, Player.player[i].Col + left, Player.player[i].Symbol);\n                    }\n                }\n            }\n            if (Player.player[0].Col + 7 &lt; Settings.maxCols)\n            {\n                if (key.Key == ConsoleKey.RightArrow)\n                {\n                    for (int i = 0; i &lt; Player.player.Count; i++)\n                    {\n                        Player.player[i] = new Position(Player.player[i].Row, Player.player[i].Col + right, Player.player[i].Symbol);\n                    }\n                }\n            }\n            if (key.Key == ConsoleKey.Spacebar)\n            {\n                Shoot.shoot[Player.player[0].Row - 1, Player.player[0].Col] = 1;\n            }\n        }\n\n    }\n\n}\nclass Shoot\n{\n    public static int[,] shoot = new int[Settings.maxRows, Settings.maxCols];\n\n    public static void GenerateShot()\n    {\n        for (int Row = 0; Row &lt; Shoot.shoot.GetLength(0); Row++)\n        {\n            for (int Col = 0; Col &lt; Shoot.shoot.GetLength(1); Col++)\n            {\n                if (Shoot.shoot[Row, Col] == 1 &amp;&amp; (Row == 0))\n                {\n                    Shoot.shoot[Row, Col] = 0;\n\n                }\n                if (Shoot.shoot[Row, Col] == 1)\n                {\n                    Shoot.shoot[Row, Col] = 0;\n                    Shoot.shoot[Row - 1, Col] = 1;\n\n\n\n                }\n            }\n        }\n\n\n    }\n}\nstatic public class Invader\n{\n    public static List&lt;Position&gt; InitializeInvader(int row, int col)\n    {\n        int startrow = 5;\/\/start position row\n        int startcol = ArmyOfInvaders.startArmyOfInvadersPosition;\/\/ start position col\n\n        List&lt;Position&gt; invader = new List&lt;Position&gt;();\n        invader.Add(new Position(startrow + row, startcol + col, \"https:\/\/stackoverflow.com\/\"));\n        invader.Add(new Position(startrow + row, startcol + 1 + col, '{'));\n        invader.Add(new Position(startrow + row, startcol + 2 + col, 'O'));\n        invader.Add(new Position(startrow + row, startcol + 3 + col, '}'));\n        invader.Add(new Position(startrow + row, startcol + 4 + col, '\\\\'));\n        invader.Add(new Position(startrow + 1 + row, startcol + col, '\\\\'));\n        invader.Add(new Position(startrow + 1 + row, startcol + 1 + col, '~'));\n        invader.Add(new Position(startrow + 1 + row, startcol + 2 + col, '$'));\n        invader.Add(new Position(startrow + 1 + row, startcol + 3 + col, '~'));\n        invader.Add(new Position(startrow + 1 + row, startcol + 4 + col, \"https:\/\/stackoverflow.com\/\"));\n        return invader;\n    }\n\n\n\n\n}\npublic class Draw\n{\n    public static void DrawItem(List&lt;Position&gt; invader)\n    {\n        ;\n        foreach (Position part in invader)\n        {\n            Console.SetCursorPosition(part.Col, part.Row);\n            Console.Write((char)part.Symbol);\n        }\n\n    }\n    public static void DrawItem(List&lt;List&lt;Position&gt;&gt; armyOfInvaders)\n    {\n        for (var i = 0; i &lt; armyOfInvaders.Count; i++)\n        {\n            if (!ArmyOfInvaders.deadInvaders.Contains(i))\n            {\n                Draw.DrawItem(armyOfInvaders[i]);\n            }\n        }\n    }\n    public static void EraseItem(List&lt;List&lt;Position&gt;&gt; armyOfInvaders)\n    {\n        foreach (List&lt;Position&gt; invader in armyOfInvaders)\n        {\n            foreach (Position part in invader)\n            {\n                Console.SetCursorPosition(part.Col, part.Row);\n                Console.Write(' ');\n            }\n        }\n    }\n    public static void EraseItem(List&lt;Position&gt; invader)\n    {\n\n        foreach (Position part in invader)\n        {\n            Console.SetCursorPosition(part.Col, part.Row);\n            Console.Write(' ');\n        }\n\n    }\n    public static void DrawShoot()\n    {\n        for (int Row = 0; Row &lt; Shoot.shoot.GetLength(0); Row++)\n        {\n            for (int Col = 0; Col &lt; Shoot.shoot.GetLength(1); Col++)\n            {\n                if (Shoot.shoot[Row, Col] == 1)\n                {\n                    Console.SetCursorPosition(Col, Row);\n                    Console.Write(\"|\");\n\n                }\n            }\n        }\n    }\n    public static void EraseShoot()\n    {\n        for (int Row = 0; Row &lt; Shoot.shoot.GetLength(0); Row++)\n        {\n            for (int Col = 0; Col &lt; Shoot.shoot.GetLength(1); Col++)\n            {\n                if (Row == 0)\n                {\n                    Console.SetCursorPosition(Col, Row);\n                    Console.Write(\" \");\n                }\n                if (Shoot.shoot[Row, Col] == 1)\n                {\n                    Console.SetCursorPosition(Col, Row + 1);\n                    Console.Write(\" \");\n                }\n\n            }\n        }\n    }\n}\npublic class Collision\n{\n\n    public static void InvaderGotShot()\n    {\n\n        for (int i = 0; i &lt; ArmyOfInvaders.armyOfInvaders.Count; i++)\n        {\n            for (int j = 0; j &lt; ArmyOfInvaders.armyOfInvaders[i].Count; j++)\n            {\n                if (Shoot.shoot[ArmyOfInvaders.armyOfInvaders[i][j].Row, ArmyOfInvaders.armyOfInvaders[i][j].Col] == 1)\n                {\n                    if (!ArmyOfInvaders.deadInvaders.Contains(i))\n                    {\n                        Shoot.shoot[ArmyOfInvaders.armyOfInvaders[i][j].Row,\n                            ArmyOfInvaders.armyOfInvaders[i][j].Col] = 0;\n                        ArmyOfInvaders.deadInvaders.Add(i);\n                        return;\n                    }\n                }\n\n            }\n        }\n\n    }\n}\npublic class ArmyOfInvaders\n{\n\n    public static int invadersColDistance = 9;\n    public static int invadersColsCount = 10;\n    public static int invadersRowDistance = 4;\n    public static int invadersRowsCount = 4;\n    public static List&lt;int&gt; deadInvaders = new List&lt;int&gt;(); \n\n    public static int startArmyOfInvadersPosition = (Settings.maxCols - (ArmyOfInvaders.invadersColDistance * ArmyOfInvaders.invadersColsCount)) \/ 2 + 5;\/\/5 e shiranata na edin invader\n\n    public static List&lt;List&lt;Position&gt;&gt; armyOfInvaders = new List&lt;List&lt;Position&gt;&gt;();\n\n    public static void InitializeArmyOfInvaders(int moveY = 0, int moveX = 0)\n    {\n        for (int row = 0; row &lt; invadersRowDistance * invadersRowsCount; row += invadersRowDistance)\n        {\n            for (int col = 0; col &lt; invadersColDistance * invadersColsCount; col += invadersColDistance)\n            {\n                var invader = Invader.InitializeInvader(row + moveY, col + moveX);\n                armyOfInvaders.Add(invader);\n            }\n        }\n\n    }\n\n\n\n\n\n\n}\npublic class Common\n{\n    public static int gameSpeed = 1;\n}\n<\/code><\/pre>\n<p>The point was to hide dead aliens from user, but not to exclude them from collection. Your implementatiion tried to clear positions of shot alien, but on the next iteration it initialized all invaders again.<\/p>\n<p>Also notice that I was forced to introduce literal <code>9<\/code> in <code>Movement.MovementArmyOfInvaders<\/code> instead of call <code>Invader.invader.Length<\/code>.<\/p>\n<p>Hope it helps.<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">1<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Shooting. Collision of the shot with a collection of List <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Without claiming to rework your design, I added collection of dead invaders(ArmyOfInvaders.deadInvader) to stored those ones, who already shot, and changed InvaderGotShot and DrawItem methods. I got rid of Invader.invader collection and introduced local variable in Invader.InitializeInvader instead of it to prevent misassigning. Please take a look: class Program { static void Main() { &#8230; <a title=\"[Solved] Shooting. Collision of the shot with a collection of List\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/\" aria-label=\"More on [Solved] Shooting. Collision of the shot with a collection of List\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[324,3781,605],"class_list":["post-14403","post","type-post","status-publish","format-standard","hentry","category-solved","tag-c","tag-collision","tag-console-application"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Solved] Shooting. Collision of the shot with a collection of List - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Shooting. Collision of the shot with a collection of List - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Without claiming to rework your design, I added collection of dead invaders(ArmyOfInvaders.deadInvader) to stored those ones, who already shot, and changed InvaderGotShot and DrawItem methods. I got rid of Invader.invader collection and introduced local variable in Invader.InitializeInvader instead of it to prevent misassigning. Please take a look: class Program { static void Main() { ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-07T12:04:02+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Shooting. Collision of the shot with a collection of List\",\"datePublished\":\"2022-10-07T12:04:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/\"},\"wordCount\":118,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"c++\",\"collision\",\"console-application\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/\",\"name\":\"[Solved] Shooting. Collision of the shot with a collection of List - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2022-10-07T12:04:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Shooting. Collision of the shot with a collection of List\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Shooting. Collision of the shot with a collection of List - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Shooting. Collision of the shot with a collection of List - JassWeb","og_description":"[ad_1] Without claiming to rework your design, I added collection of dead invaders(ArmyOfInvaders.deadInvader) to stored those ones, who already shot, and changed InvaderGotShot and DrawItem methods. I got rid of Invader.invader collection and introduced local variable in Invader.InitializeInvader instead of it to prevent misassigning. Please take a look: class Program { static void Main() { ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/","og_site_name":"JassWeb","article_published_time":"2022-10-07T12:04:02+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Shooting. Collision of the shot with a collection of List","datePublished":"2022-10-07T12:04:02+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/"},"wordCount":118,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["c++","collision","console-application"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/","url":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/","name":"[Solved] Shooting. Collision of the shot with a collection of List - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-10-07T12:04:02+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-shooting-collision-of-the-shot-with-a-collection-of-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Shooting. Collision of the shot with a collection of List"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/14403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=14403"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/14403\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=14403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=14403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=14403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}