1) Code Repos and Versioning are not backup.
2) They are *especially* not backup if you forgot to commit your last good revision.
3) Especially if something weird was happening with your attempt to restore to what you thought was a previous decent version, but apparently it wasn’t so you wiped out a lot of your good work, like. almost 2 months worth (which, at the rate I go – is like – a day or two’s worth, still bites).
4) If you may recall, I was debating to use the “Scriptable Object” approach (I believe I posted that in my last entry) – this means, it’s now a perfect opportunity to do so. More than I even thought before with my last post.
5) I’m not sure why but I’m intimidated. I think it’s because while it’s clearly part of Unity and apparently an important part, and while there are documents and videos out there, there are not nearly as many posts/documents/videos on this issue as there are on many other simpler concepts. I’m sure once I dig in, and run into problems, searches for specific solutions will arise and help out on that front.
6) So, even though I’m intimidated, I did do *something* today – though it wasn’t code (at least, not coding for my games – that other coding will be mentioned shortly)… I ended up revamping how I’m drawing everything. Previously it was a straight up 2D game. The road was flat, it looked like vehicles were basically flat against the ride from the profile view. This is fine for the basic idea and if I’m wanting to do something super quick, but since I’m doing a revamp and no longer in “48 hour gamejam” mode, I can take the time to fuck with this a bit more. I’m still not going to be uber amazing at this, because I still want this to get out sooner rather than later (and boy it’s already later, but I think that’s sorta how development in general works: there’s always more to do, more you can do, and more you want to do). I’m gonna upload a pic of the new style that I’m doing. I’d *really* love to have a consistent set of 3D vehicles I could use, but that would require hiring an artist, with money I don’t have. And there are assets out there, but as I said, “CONSISTENT”. But I did download a whole bunch of other vehicle images and I’m going to just do my own art, instead of using the free bitmaps and stuff I’ve found online. Regardless… Here’s the little bit of rejiggering I did today – adding a z-axis/depth to the view, so you have depth perception, and instead of vehicles just being on top of each other, they pass behind one another now 🙂 Oh, and a little skyline added. Perhaps each level I’ll add a different skyline or image, dunno yet.
The second thing is that my web-designer friend and I are working on a new project. Nothing major, a sort of random grabber of pages in a directory – each of us will contribute various things to this cache of pages. Might be images, might be video, might be a simple text page, might be something very complex… Links in the pages won’t go anywhere or do anything but grab more pages from this cache – you never know what you’ll find, there is no design of links or outside architecture. In a sense, now that I think about it, it might be something one might be able to call a Non-deterministic Finite Automoton, though don’t quote me on that – I’m no computer scientist.
But I like to code, so I figured I’d do a little attempt at something and googled around for solutions and did my first thing which is a beeping “alarm” clock page.
The site is dopplegang.org (goes back to a highschool joke – and my current WoW guild); So I made a dg visually that looks a little like LED clocks, and just have it blink in sync with the annoying alarm sound.
Anyways, to do the jQuery code for centering my blinking image in the screen I ended up with a problem. With the anonymous function, one of the tutorials had it set to load on window resize. This meant that if a user resized their window, the centering of the image would also happen; otherwise the window would move but the image would stay in the same position relative to the original window, not the newly sized window. This snippet/post by the person had you merely call “window.resize()” when you first load the page, which, in theory would then just trigger the centering function, but for whatever reason it didn’t work.
Another site mentioned using “onLoad()” (or whatever it’s called – I’m not a JS coder). That worked fine for the first time I loaded the window, but not if I resized.
I was stumped. How can I get it to load when I both load the window and resize the window? It would be patently ridiculous to create two separate functions that did the same thing to be called each time. So this anonymous function was good, and what they’re having me do is good, but how in the bloody hell do I attach the lambda (what we call “binding”) to multiple functions to be called at the proper time? Well there it was:
left: ($(window).width() - $('.valignmiddle').outerWidth())/2,
top: ($(window).height() - $('.valignmiddle').outerHeight())/2
Line 6, the “$(window).on(‘load resize’…” code. All you need to do is basically append each function name, to which you want to bind the lambda, onto this string that acts as, apparently, a parameter list… I don’t know how a list structure works in JS – though I had thought it would use commas to separate each element; somehow it seems that it uses a space character to separate the function names – I’m not sure if that’s a jQuery thing or a JS thing. Either way – it got the job done 🙂