Lucky Day's Wizard War! for Android development thread
View Single Post
August 5th, 2013, 21:48
Whew - had big fun on this over the weekend.
On Thursday I got into a groove on developing weapon images and working on balancing. Still a ways to go for balancing but most of the weapons went quick. A lot of the legwork was already done by the time I looked at it again - I got most of the free to use images from one site. Weapon images are pretty popular.
Then I got sidetracked over the weekend. In testing I found the spider gave me her web as a weapon so I started using it. It looked way cool (I'll get you pictures tonight), having been so used to swords and stuff for so long, but taking a spider's web isn't exactly something the player should be doing.
Then I got the idea, why don't I try limiting it? And as usual it turnede out to be real easy; then turned out to be difficult in ways I didn't realize.
The limiting the uses was fine - I could get the player to run out of them and be stuck punching his way through rest of the combat. I could even send said player a message saying how many left.
When I picked up multiple webs I saw they were reloading themselves to full. So there was an issue with persistence. Since I added a few variables to do this I needed to add them to the persistence. This was a bit of a pain because I had to do it in two places - for the current weapon and the inventory loop.
The big problem was "downcasting"
This works fine for my Armor class but my Weapon class (both of which are child classes of my Item class) kept giving me fits. I got one of those "magic dreams" in the middle of the night where you wake up with the song "Yesterday" or adding "Mexican Horns" to "Ring of Fire" or some such. In my case it was the solution to the problem: manually cast it.
By doing it manually I just added the variables that weren't defined in the parent cast and had the children equal - most of the first part is done in the contructor anyway. I just had to change the infiniteUse variable to false since a Spider can't run out of webs after one test and you can (ie. The AI cheats!). Hope folks will forgive me for that. The other side to that is you will get a full weapon irregardless.
Okay, running out of weapon then relying on your fists makes for a good challenge - you can try and beat it out of the rest of the enemy 1hp at a time or you can run away. This made for interesting dynamics but I realized, why would anyone equip an item that ran out, so I tried an experiment with equipping items in combat.
I took the code straight from the Camp activity then made some adjustments for the combat activity and it worked right out of the box. I added a button for it. I turned off the option to equip armor thereby reducing some of the code - because let's face it - it takes more than 1 turn to swap your armor typically.
The only issues I had were taking damage or not after equipping and in doing so I discovered equipping an empty item slot (a "none") was not being properly ignored. I managed to fix this in both spots.
My only concern is now I have double the code. Hopefully I won't need to make many changes down the line. Properly I should have one method and have both activities call the same but can get really hairy as an activity is not a normal class.
With that done I thought I'd tackle the issue of full inventories at the end of combat - the loot phase. As it was it just told your inventory was full (tough luck!). This wasn't ideal though.
I ported the drop code over from the Camp activity, and what do you know, it worked almost perfectively too.
Until I discovered you only needed one empty slot to take everything (so far this is just weapons and armor).
Some research found that camp had twice the code checking for this so I dropped it in a method and it checks it a second time if another item is selected and only one slot is available.
Now I was happy and free. I reduced my keys to 0 and we drove over to my nephews to test it (its the oldest's 16th birthday). Unfortunately, combat didn't work and they were stuck with no keys. Oy! For some reason they kept running around banging onto walls on purpose after that so there's still some semblance of a game just in exploring I guess.
I fixed that last night. Combat Activities still has a tendency to stack and the first one will end up being meaningless so its ultimately a waste of time. I tried to track the state and close the activity if there's more than one. This didn't work at all. By the time I had my nephews try it I enclosed the combat into an "else" when it was supposed to work. That actually blocked it, so for some reason it seems to recognize that its stacked but continues normal anyway, when it should just exit. I thought it would be about a 1/400 chance of doing this but the odds seem more like 1/40. Its not a huge deal but its noticeable and people will complain. grr.
Developer of The Wizard's Grave Android game. Discussion Thread:
Join Date: Oct 2006
Location: The Uncanny Valley
View Public Profile
Send a private message to Lucky Day
Find More Posts by Lucky Day