Dynamite: Day 10 – Game Logic
So, I’m filling out the game logic today. I’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 “unlimited bombs” for you!
A special bomb effect:
I’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.)
.. After a bit of a break and some thinking, I’ve got a pretty long “TODO” 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 ..
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’t be shown when the game is in play.
I’ve added the ability for lights to roam about. And here’s a cool looking screen that is the result of me trying to get my renderer to work on larger level sizes:
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.
for (int iy=i1,jy=j1,yflag=0; yflag!=3; iy+=sign(i2-i1),jy+=sign(j2-j1)) { if (iy == i2) { yflag |= 1; } if (jy == j2) { yflag |= 2; } for (int ix=i3,jx=j3,xflag=0; xflag!=3; ix+=sign(i4-i3),jx+=sign(j4-j3)) { if (ix == i4) { xflag |= 1; } if (jx == j4) { xflag |= 2; } for (int ia=0; ia<2; ia++) { int x = iy + ix - i2 + ia; int y = jy + jx - j2 ;
Anyway, I think that's all I can handle for one day. Until tomorrow!
-Phil