{"id":644,"date":"2010-10-08T20:10:05","date_gmt":"2010-10-09T02:10:05","guid":{"rendered":"http:\/\/www.philhassey.com\/blog\/?p=644"},"modified":"2010-10-08T20:10:05","modified_gmt":"2010-10-09T02:10:05","slug":"dynamite-day-10-game-logic","status":"publish","type":"post","link":"https:\/\/www.philhassey.com\/blog\/2010\/10\/08\/dynamite-day-10-game-logic\/","title":{"rendered":"Dynamite: Day 10 &#8211; Game Logic"},"content":{"rendered":"<p>So, I&#8217;m filling out the game logic today.  I&#8217;ve now got the display rendering buttons for the types of explosives you have along with an indication of how many you have in your pockets.  No more &#8220;unlimited bombs&#8221; for you!<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz028.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz028.png\" alt=\"DynamiteScreenSnapz028\" title=\"DynamiteScreenSnapz028\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-645\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz028.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz028-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>A special bomb effect:<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz029.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz029.png\" alt=\"DynamiteScreenSnapz029\" title=\"DynamiteScreenSnapz029\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-646\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz029.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz029-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>I&#8217;ve got a few different bomb types which are all pretty exciting.  The main bomb type is one where you drop the bomb run off and then press a button to explode it.  (As in the original game.)<\/p>\n<p>.. After a bit of a break and some thinking, I&#8217;ve got a pretty long &#8220;TODO&#8221; list now .. there are of a ton of little things that I need to have working nicely before I can really create a real level ..<\/p>\n<p>One of them was defining a padding edge for the level.  This is a sanity feature to avoid anything blisteringly dumb happening.  It as a 4 box wide edge around the whole level.  It also gives the user a visual cue as to how far they are from the edges of the map when they are editing.  The edge won&#8217;t be shown when the game is in play.<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz030.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz030.png\" alt=\"DynamiteScreenSnapz030\" title=\"DynamiteScreenSnapz030\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-649\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz030.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz030-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>I&#8217;ve added the ability for lights to roam about.  And here&#8217;s a cool looking screen that is the result of me trying to get my renderer to work on larger level sizes:<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz031.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz031.png\" alt=\"DynamiteScreenSnapz031\" title=\"DynamiteScreenSnapz031\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-651\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz031.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz031-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>I eventually got my renderer working, but I produced some of the most awful looking code in my life while doing so.  Look away if you can feel pain.<\/p>\n<pre>\r\n    for (int iy=i1,jy=j1,yflag=0; yflag!=3; iy+=sign(i2-i1),jy+=sign(j2-j1)) {\r\n      if (iy == i2) { yflag |= 1; }  if (jy == j2) { yflag |= 2; }\r\n      for (int ix=i3,jx=j3,xflag=0; xflag!=3; ix+=sign(i4-i3),jx+=sign(j4-j3)) {\r\n        if (ix == i4) { xflag |= 1; }  if (jx == j4) { xflag |= 2; }\r\n        for (int ia=0; ia<2; ia++) {\r\n            int x = iy + ix - i2  + ia;\r\n            int y = jy + jx - j2 ;\r\n<\/pre>\n<p>Anyway, I think that's all I can handle for one day.  Until tomorrow!<\/p>\n<p>-Phil<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, I&#8217;m filling out the game logic today. I&#8217;ve now got the display rendering buttons for the types of explosives you have along with an indication of how many you have in your pockets. No more &#8220;unlimited bombs&#8221; for you! A special bomb effect: I&#8217;ve got a few different bomb types which are all pretty [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[116],"tags":[],"class_list":["post-644","post","type-post","status-publish","format-standard","hentry","category-dynamite"],"_links":{"self":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/comments?post=644"}],"version-history":[{"count":6,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/644\/revisions"}],"predecessor-version":[{"id":654,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/644\/revisions\/654"}],"wp:attachment":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/media?parent=644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/categories?post=644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/tags?post=644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}