{"id":627,"date":"2010-10-06T20:25:35","date_gmt":"2010-10-07T02:25:35","guid":{"rendered":"http:\/\/www.philhassey.com\/blog\/?p=627"},"modified":"2010-10-06T20:25:35","modified_gmt":"2010-10-07T02:25:35","slug":"dynamite-day-8-player-and-guard-movement","status":"publish","type":"post","link":"https:\/\/www.philhassey.com\/blog\/2010\/10\/06\/dynamite-day-8-player-and-guard-movement\/","title":{"rendered":"Dynamite: Day 8 &#8211; Player and Guard movement"},"content":{"rendered":"<p>So far today I&#8217;ve just been doing some cleanup in my code.  I&#8217;m about to add a &#8220;play&#8221; mode so I can try out my levels, which involves having information easily available to know what is solid or not.  I&#8217;ve updated my tiles.json file to include that information on a per-tile basis, and I&#8217;ve used that along with some other things to clean up my rendering code as well.  <\/p>\n<p>I also am considering having the ability to rotate the screen 90 degrees.  This way you can see behind walls easier.  I had considered other options like a &#8220;short wall&#8221; mode or whatever, but it all started seeming really un-cool.  Here&#8217;s a picture of the short-wall mode:<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz023.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz023.png\" alt=\"DynamiteScreenSnapz023\" title=\"DynamiteScreenSnapz023\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-628\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz023.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz023-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>You can see really easily in this picture how light can leak through walls (those short ones).  I haven&#8217;t decided on my solution to that problem yet.  I think I&#8217;m going to have to get this running on the iPad, maybe at the end of this week, and evaluate how fast it is running and if I can afford to do more complex lighting.<\/p>\n<p>Was about to get after getting the game playing, but I&#8217;m finding that jsoncpp is crashing during shutdown of my program.  I&#8217;m getting a traceback like:<\/p>\n<p>pure virtual method called<br \/>\nterminate called without an active exception<br \/>\nProgram received signal:  \u201cSIGABRT\u201d.<br \/>\n(gdb) backtrace<br \/>\n#0  0x97803ef6 in __kill ()<br \/>\n#1  0x97803ee8 in kill$UNIX2003 ()<br \/>\n#2  0x9789662d in raise ()<br \/>\n#3  0x978ac6e4 in abort ()<br \/>\n#4  0x975b7fda in __gnu_cxx::__verbose_terminate_handler ()<br \/>\n#5  0x975b617a in __cxxabiv1::__terminate ()<br \/>\n#6  0x975b61ba in std::terminate ()<br \/>\n#7  0x975b6753 in __cxa_pure_virtual ()<br \/>\n#8  0x00016cd4 in Json::Value::CZString::~CZString (this=0x33a180) at \/Users\/phil\/code\/idynamite\/osx\/..\/ext\/json\/json_value.cpp:199<br \/>\n#9  0x0001e06b in std::pair<Json::Value::CZString const, Json::Value>::~pair (this=0x33a180) at stl_pair.h:69<br \/>\n#10 0x0001e089 in __gnu_cxx::new_allocator<std::pair<Json::Value::CZString const, Json::Value> >::destroy (this=0xbfffe8ff, __p=0x33a180) at ext\/new_allocator.h:107<br \/>\n&#8230;<\/p>\n<p>Turns out this is due to some sort of bug in jsoncpp which makes it not work as global variables.  Which I guess the old notion that global variables are bad news is hard to get away from.  So I wrapped up all my json away from being globals and it works fine now.  Less globals is certainly a good move, whatever the case.<\/p>\n<p>Next off, I&#8217;ve now added a toggle to switch between editor mode and play mode.  The editor saves the level state so that whatever happens during play doesn&#8217;t permanently damage the level.<\/p>\n<p>With a bit more work, I&#8217;ve got the &#8220;play&#8221; mode starting to take shape.  The player now walks to the tile you click on!<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz024.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz024.png\" alt=\"DynamiteScreenSnapz024\" title=\"DynamiteScreenSnapz024\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-630\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz024.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz024-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>And now I&#8217;ve got a guard running around me like a crazed maniac.  The arrows on the floor are special codes that tell the guard where to run.<\/p>\n<p><a href=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz025.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz025.png\" alt=\"DynamiteScreenSnapz025\" title=\"DynamiteScreenSnapz025\" width=\"512\" height=\"406\" class=\"aligncenter size-full wp-image-633\" srcset=\"https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz025.png 512w, https:\/\/www.philhassey.com\/blog\/wp-content\/uploads\/2010\/10\/DynamiteScreenSnapz025-300x237.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>I&#8217;ve also got animation going on the guards and the player, just sorting out some bugs on those.  Tomorrow I hope to get a win condition and a lose condition and some more explosives going \ud83d\ude42<\/p>\n<p>-Phil<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So far today I&#8217;ve just been doing some cleanup in my code. I&#8217;m about to add a &#8220;play&#8221; mode so I can try out my levels, which involves having information easily available to know what is solid or not. I&#8217;ve updated my tiles.json file to include that information on a per-tile basis, and I&#8217;ve used [&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-627","post","type-post","status-publish","format-standard","hentry","category-dynamite"],"_links":{"self":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/627","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=627"}],"version-history":[{"count":5,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"predecessor-version":[{"id":635,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/627\/revisions\/635"}],"wp:attachment":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}