Ugh, not much to talk about today (yet I still somehow generated more than 500 words), and nothing to show. I changed the way lasers work so that they do more damage the longer they stay on a target. This was done for two reasons, first the lasers didn’t really provide a real tactical difference from guns. Sure, the guns did more damage, and had a shorter range, and were a bit better against shields, but they were both basically weapons that you got close enough and just keep the enemy in range. They didn’t really encourage different behaviors the way the missiles do.
So you want to keep the lasers on a single target for as long as possible. Which makes things a bit more interesting. Another thing they allow is a new special ability I’m going to add. You’ll be able to drop satellites that will act as conduits for your lasers. Get withing range of your laser satellite, then anything that’s within its range is within you range. Where this will really shine is when you set up multiple laser relays within each range of each other. Suppose that you set up the relays along a route that you expect the enemy to take. No you can keep them in range the whole time, which allows your laser to target a single ship longer, and do maximum damage.
So that really wasn’t too bad. Then when I tried to test it I ran into some bugs that had cropped up due to some changes that I had made in the interface. Those weren’t too bad, but I also ran into a problem where my ships weren’t responding to clicks. I tie into the NGUI event system to have the ships respond to mouse clicks, and for some reason it just wasn’t working. I finally figured out that I had two colliders, the ship, then a background collider that would catch mouse clicks and movement and turn them into map movements. The background collider was set behind the ship colliders which is what let it work before.
I finally discovered that since neither the ships nor the background had any sort of NGUI scripts attached to them, they were both treated as though they were at the same depth. Which meant that the background intercepted the click meant for the ship. Fortunately NGUI includes the code when you buy it, otherwise I never would have found out what was going on. Also it let me create a fix. To see if you clicked on anything it runs a ray from the camera into the world, and sees if it collides with anything. It then sorts all of the collisions by depth and gives the even to the highest object. Since everything was at the same depth it would give it to the first thing the ray hit, which was always the background for some reason. So I modified the sorter so that if two objects are at the same NGUI depth, then it sorts them based on which object is at a deeper world coordinate depth. Problem solved. Still pretty annoying how much time it took.