{"id":171,"date":"2026-05-15T14:01:43","date_gmt":"2026-05-15T14:01:43","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/d_harkless\/?p=171"},"modified":"2026-05-15T14:01:43","modified_gmt":"2026-05-15T14:01:43","slug":"free-friday-5-15-26","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/d_harkless\/2026\/05\/15\/free-friday-5-15-26\/","title":{"rendered":"Free Friday 5-15-26"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Today in class, I added a missile.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"610\" height=\"600\" src=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2026\/05\/image-2.png\" alt=\"\" class=\"wp-image-172\" style=\"aspect-ratio:1.0166853243776321;width:434px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2026\/05\/image-2.png 610w, https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2026\/05\/image-2-300x295.png 300w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This is the code for the missile.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Missile(Sprite):\n\tdef __init__(self, spriteshape, color, startx, starty):\n\t\tSprite.__init__(self, spriteshape, color, startx, starty)\n\t\tself.shapesize(stretch_wid=0.3, stretch_len=0.4, outline=None)\n\t\tself.speed = 20\n\t\tself.status = \"ready\"\n\t\tself.goto(-1000, 1000)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the code for firing the missile.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tdef fire(self):\n\t\tif self.status == \"ready\":\n\t\t\tself.goto(player.xcor(), player.ycor())\n\t\t\tself.setheading(player.heading())\n\t\t\tself.status = \"firing\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the code for the missile to move.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tdef move(self):\n\t\n\t\tif self.status == \"ready\":\n\t\t\tself.goto(-1000, 1000)\n\t\t\n\t\tif self.status == \"firing\":\n\t\t\tself.fd(self.speed)\t<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the missile code. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>missile = Missile(\"triangle\", \"yellow\", 0, 0)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the key for the missile.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>turtle.onkey(missile.fire, \"space\")\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the code to check for a collision between the missile and the enemy.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if missile.is_collision(enemy):\n\t\tx = random.randint(-250, 250)\n\t\ty = random.randint(-250, 250)\n\t\tenemy.goto(x, y)\n\t\tmissile.status = \"ready\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today in class, I added a missile. This is the code for the missile. This is the code for firing the missile. This is the code for the missile to move. This is the missile code. This is the key for the missile. This is the code to check for a collision between the missile [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-171","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts\/171\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}