Basic Game Complete

Well – it’s mostly “done”.  There is no polish, but the core is there.  I’ve revamped the instructions and colors, removed the hover effect,have 25 levels now made.  Had mess with scaling a lot to make sure I got it working on Android and PC, but in theory it should work on all android screen sizes.  I should see if I can get it work on a lower API (I’m using 5/Lollipop now).  Jelly Bean would probably be the lowest I’d want to go, not sure if it will compile for that low.  We’ll see.  Anyways,

Here’s video.  I do wish I had some backing ambient, but wasn’t too keen on the stuff I had before and that takes up more resources, and I suppose I could make 25 loops, I just kinda want to be done with this thing.

LastLevelCompleted / Loading Next Available Level

Well – I did it.  After slogging through the bullshit from my last post, I got everything laid out well.

There is one issue that I was having on the start screen after revamping things with regards to how the buttons work.  In Unity you can create a button and have a transition effect (tint, scale or image swap).  I did an image swap to match the game layout.  I was reminded of why I did what I did when setting up the levels.

When I started this project, my initial thought was that I would have buttons be the main UI, just lay them out with the transition effect- all the animation code would be taken care of.  There is a default state, a hover state (mouseOver), a pressed/clicked state and a disabled state.  You can set images for each of those states.  In my case, the hover state is a lighter square color.  Pressing makes the state revert to “default” image.

Something stupid happened along the way.  If you press down on a button, then it shows the “pressed” state…  Then, while still holding the mouse down, drag your mouse off the button, it reverts the state of the button to the “hover” state.  Even though the mouse is no longer hovering over it.  It should revert to the default state, not act as if my mouse is still on it).  This indicates that the mouse state detection only updates when a player releases the mouse.

When the mouse has no buttons being pressed, the mouse location is wherever the mouse actuall is on screen, and Unity seems to be able to deal with it as such…  But, when you press the button, it seems to retain the location of where the mouse clicked, not where it is now.  So when I leave the mouse position, while still having the mouse clicked, even though the mouse is no longer hovering over a button, when I leave the square, it acts as though the mouse has been released, and my location is still where it was when I clicked the square/button.  I’m not going to waste time making a video now of it, but it’s annoying and I think that’s why I ended up doing something much more complicated than just using buttons for the state of my squares on the grid.

I forgot that was the case, however, and when creating the loading screen, started from scratch with… BUTTONS!  And so now I have that dumb as shit issue.  Oh well.  Not going to worry about it.  Too much work to try to fit my workaround from the gameplay into the level select screen.

Anyways, so the next bit of progress was saving a completed level to the playerprefs file so when you load the game, the next available level and all previous levels are now highlighted as selectable, and the player can do so.  I need to do a little error checking because right now if I don’t have a level actually built, but the levelselect menu shows it as available, it will, of course, generate an error when clicking.

In the video below I demo the glitchy transition states for the buttons (note how I move off “4” and it suddently lights up?  You’ll see when I hover over numbers they light up and if I press down, they go dark.  If I move off while still pressed, they light up again as if I’m hovering over them (and will go dark if I move back over it)… only when I release the mouse button will it do the right thing).Then you can see how the available levels are highlighted when I return to the menu after completing a level.

 

Menus, Prefabs and ass biting

So I started to make the menu system.  Having to revamp the level select grid itself… Instead of sprites, I’m having to load them as UI Images (which can then be used as buttons).  I forgot that’s how it worked so I struggled with that.  Basically level select will appear to be the same sort of 5×5 grid as the gameplay, only with sequential numbers displayed in each square as opposed to the “move” values in the gameplay grid.

So I set it all up, finally got the first level to load (after figuring out the stupid “UI Image” issue), so I’m psyched, except…

Since I dragged the 5×5 grid from the prefab, I made the changes and I think I hit “Apply” which then applies the values of the changed items to the prefab item itself.  Which means, the changes I made for the level select screen only got transferred into the game play screen.

This means that the of the squares are all wrong (as they apparently loaded in from the pre-fab).  Except now I wonder how, exactly that worked, because I didn’t say to load it from the prefab.   I dunno it’s confusing and I’m annoyed because now I have to go back in and redesign the levels (not hard, really just change some values).  But still annoying.