Friday, July 29, 2016

TOE week 8: Super Parabolic Light Blubs Breaking Over My Head!

                So much of being a programmer seems to be figuring out just how to get the syntax to work for you. When I still worked in industry I remember that many of the Engineers had three or four books on their desks at all times. I understand why more now. Often half of the battle seems to be leafing through Unity’s website and looking at example code and then saying, “Oh that it what this it for!” 

                Then there are other times when really easy things are hard. I spent an entire laptop battery trying to figure out how to get the angle of the trigger object that my secondary weapon hit. I used my Google fu to try to find out how to do this and because I was using ontrigger instead of oncollision this actually seemed impossible to correctly set up given what I found. Fine! I will use oncollision and make this secondary weapon use Unity’s physics. And that worked I could get the angle BUT because I was scripting the motion of the object and Unity’s physics was making the thrown object move in some super crazy ways. The thrown object would sometimes fly off of the Z axis entirely. So the final result was right but the trip to the result was just wrong. 

                This was like probably two hours of trying and checking. Then someone broke a light bulb over my head. Wait can’t I just col.Transform.rotation? OMG! I felt like such an idiot for it taking me THAT long to figure out something so damn simple. But then I saw it working and felt like such a champ for making it work. The jury is still out on what is what. 

                Last week I set up some crappy looking secondary weapons. Well two of them where crappy the first one is still fine. I was reminded of something my animation Professor in college said. “When the animation moves, you will feel amazed. Don’t ever lose that. But the next step is then asking, how do I fix it?” When I showed my wife who is a Physics teacher what I had set up and told her that this weapon was supposed to be a parabola. She showed me how to make parabolic motion work using an equation. We had one small hiccup with me not knowing the Time.Deltatime is not the entire time an object’s existence and hence not equal to elapsed time. After I had created an elapsed time variable it was super parabolic! 

                Sending a message through objects in Unity is kind of crazy. Or I should say that when you have a target that can be hit by five different things but don’t know which object hit the target, it seems kind of impossible. Or I could just use the built in function SendMessage in Unity then passing values between objects that don’t know about each other is actually completely possible. It really boils down to, 'do I know what the information I need is called?' My Google fu for this was ‘dealing damage in unity’. Found lots of things that were less than helpful. Eventually found a really helpful tutorial. The tutorial wasn’t even in C# but I was able to convert the Java to C#. That is how far I have come! I really still can’t claim to be a master programmer but I seem to be figuring it out. The end result was this though. I now have 4 secondary weapons that all can deal damage to any object that is tagged as a Target. Pretty freaking neat!

                Trying to find a way to pass messages between objects took even longer than trying to figure out of to get an angle of a slope that a was hit. I think it took me 3 hours to figure out how to get that angle. It took me 6 to find a good way to talk to objects that don’t know about each other. But again allow me to once again say this is insanely fast! Unity is still stupid amazing!

Friday, July 22, 2016

TOE week 7: Secondary Weapons and Secondary Priorities



              This week I managed to implement 3 secondary weapons. Aside from a couple of Google searches to tell me, ‘just how do I use this syntax?’ everything was pretty easy aside from new things I broke. I also colored some pictures for the other project that I am still trying to finish. I now have some Blender work to do to finalize the background of the image. This week wasn’t a good week for the game but it wasn’t a bad one either. More down the middle. 

                My three new weapons are basically a gun, a boomerang, and an angry bird. They don’t all behave correctly at all times. But that is standard fair as I have seen of late. The angry bird a parabolic based weapon works great until I cross over the  0,0,0 mark in the world and x is negative, then it decides that it doesn’t need to fly up anymore. There is something fishy about this. I will have to look into it and find out how to kill this problem. 

The gun and boomerang went off mostly without a hitch. Guns in a 2D platformer are pretty simple. Send object that way then destroy object when too far away. Aside from the problem that when wall sliding the secondary weapons are shot in the direction of the wall the player is stuck to… Really minor but wrong. I could nix this real fast by saying you can’t fire a secondary weapon while wall sliding but I haven’t decided if I want that or not. Firing from a wall is actually kind of cool. Think Megaman X. 

I still don’t love the Get Component calls in Unity C#. I wish I could just say hey these two attached objects should know about each other’s public variables. I guess that is what a Get Component call really does but it is clunkier than C++. Really though that is the only thing that Unity C# is clunkier than C++ about. 

I haven’t been able to work as hard on this project this week or even on the other project. I am the stay at home dad again. But as of end of day today the wife is on Summer Vacation again so I can put in more time next week maybe… I say maybe because we have A LOT going on next week with my son’s doctors visits. Our free days are rapidly disappearing. Not for fun cool stuff either. Also this week I focused a fair amount of time into fitness and was just too damn tired to work on anything game related as much as I should have. 

I had some delusions that I could hammer out this demo before my wife went back to work in August. YEAH that really doesn’t seem likely now. Sigh. Delusions of grandeur I suppose. I am also going to visit more family in a week and I really want to bring my Laptop to show this off to people. I regret not brining it for our last trip but there wasn’t enough room in the car and I didn’t want to crush the thing. 

Next week I might have to put in some targets to hit with my fancy new Secondary Weapons. I also need to find a way to assign what weapon you’re using. Like pick up a gun and drop the boomerang.


Friday, July 15, 2016

TOE week 5 and 6: The Hardest part is actually the Easiest part.



Last week was a bit of a wash, I practically did nothing. I was on vacation without my laptop we had limited room in the car for our trip and my laptop is bulky and I didn’t want to crush it or something. I did draw for about fifteen minutes and it was a crappy drawing so it doesn’t count. There was some good however one of our friends down south is a Graphic Artist who took a look at my entire sketchbook and he liked my designs for this TOE project that I’m working away on. He did point out a few things for my boss designs but overall he liked my art. I don’t think I have had someone look through my entire sketchbook since I was in college. It felt good. I also got to have my sister in law, brother in law, nieces and nephew play the game a little bit when we got back home.

I know that I said I was going to be coding for awhile but the latest assignments have be art related. A while ago I made Halo armor out of card stock and fiberglass resin. The part I was most looking forward to was painting the armor. That was basically my favorite part of that project. One of the other projects that I am stupid close to putting a bow on needs me to ‘paint’ some things. I was actually excited about that part. The part that I didn’t want to do was scan the drawn artwork from my sketchbook. 

                I can’t even say why something so insignificant was preventing me from doing something that I actually love to do. Twain doesn’t work in Photoshop anymore unless it is 32 bit and my scanner doesn’t scan at a resolution that I’m happy with not because of the scanner but because of the only program that works with the scanner on Windows 10 maxs out of 300 dpi. Not bad really but all of these things combined made me really hesitant to attempt even scanning anything. I had been meaning to just scan some drawings since Sunday. I just did it TODAY. I also got around to painting one of my drawings TODAY as well because I finally scanned it! I also did scan in a landscape piece from the sketchbook that was supposedly for this project. I don’t know if it yet fits but it was something that I promised last blog. 

                So no new code, no secondary weapons, no animations… I have to finish the stuff for the other game before I can put more attention onto this project. I am going to try to finish most of that stuff this weekend. It is all scanned now so the hard part is over…

                Going to shut up now and post these drawings. 

 

Friday, July 1, 2016

TOE week 4: The opposite of progress is...

I really regret complaining about how smoothly things have been going as of this moment.  I didn't really work on the project very much this week. Basically I fixed the problems created from last week's post. You can no longer pretend that you're Megaman X in my game and Air Dashing no longer allows for the player to Air Dash again after hitting the ground. I then briefly looked into how to make the player duck using scale but that just let them duck and then pass through collision all together. So not working! Kind of like me! Oh sick burn! 

Anyway next week is probably going to be just as bad if not worse as I am currently out of town with no way to work on the code. Yeah even this very update is being typed on my wife's computer. I am going to be focusing on some art stuff on this project or the other one I should be finishing. This week is about being armed with a pencil and paper instead of keyboard and code. I do need to create some compelling back grounds for this project and right now would be a great time for that! 


Really there isn't a lot to say and I'm not completely sure that there will be a lot more to say next week. I might be able to post some of the thumb nails for the backgrounds next week in lieu of words.