Buttons Simulator 2016

As you may or may not know from my WIXOSS blog entry, currently the only thing working about that game is the menu (and even then really just one button does anything, although it does play music!).  However, I recently discovered that while my ‘settings’ button was taking me to the ‘settings scene’.  It was more complicated than it should have been.  Thanks to “Learn How to Code By Making Games – The Complete Unity Developer” course on Udemy.  I was able to learn a much easier process of doing it.  In other words, Button Simulator got a major update!!!!!

In Unity each level is called a scene.  So if I want to go from my start menu scene to my setting menu scene I have to tell the button which scene or ‘level’ I want it to go to.

Originally I wrote a script that handled the transitions, it looked something like this.

public void start_menu(){

Application.LoadLevel(1);

}

public void settings_menu(){

Application.LoadLevel(4);

}

So in that example using start_menu() will load the scene labeled as 1 in the build, which is the start scene.  Now there are a lot of things wrong with this.  For one, I would have to write a line of code for each single scene, as you see with my settings_menu().  Then I have to keep track of which number it is in the build.  What if I change a number of something?  Then everything breaks. Bad!  Bad programming!

So how did I learn to do it the right way (or atleast in a better way)?  Well, first off I created a new game object called LevelManager.  Then I gave that object my script as a component.  Then I got rid of all the previous code I had written and wrote this one line.

public void loadLevel(string name){

Application.LoadLevel(name);

}

That one line does the work of ALL the other lines I had and would have had in the future for changing levels.  It’s so simple!  The LoadLevel() function apparently looks in the build for either the number or the name.  So when you connect your button to the LevelManager object we created and specify loadLevel(string name) as the function to run onClick() it will give us a place to input a string.  That is where we put the name of the scene we want to go to!

loadlevel

So on the settings button on the start menu we put settings_menu as the name and ta-da! It goes to that scene.  This is great because if we know what button we are working on, it is easy to keep track of which scene we want to go to. If we need to change the build order, it will just search for the names, so it doesn’t matter.

So WIXOSS got an update today.  Buttons should now respond better, or at the very least, more efficiently.  (Really it’s just good design, probably didn’t have an effect on game speed, but I like to think it’s a big change!)  Just a really good trick, I am glad I learned!

Project: WIXOSS

In Japan there exists a trading card game called WIXOSS (pronounced: we cross).  It is your basic card battle game.  You have a main card called your LRIG that you grow as the game continues.  You have SIGNI which are summoned based on your LRIG.  You can use ARTS which you can use to change the battle at a critical moment.  And you have a Life Cloth, whenever you lose all of you Life Cloth, you lose.

There is an official WIXOSS video game in Japan only but I wanted to create something a little more accessible and easily updateable.  Plus, this is my “big project”.  I suspect it will take some time to get the game working, then make it look nice.  But I want this to be the project that I look back on and say “Wow, I did this.”

At this time I am at such a loss for how to begin programming this.  I need to make a rules engine that knows who’s turn it is, when to draw cards, when a player can or can not do something, account for abilities of cards.  It seems very daunting.

Then there is the whole “programming every single card into the game thing”.  Which might be the easier part but will certainly take some time.

I believe I need to make everything in the game an object. The different zones on the field are objects.  Each card is it’s own object.  Are card effects objects? That’s a lot of objects.  The reasoning for this is that should a rule suddenly change, or a new mechanic be added to the game, I wont have to rewrite the code in each card to account for it.

I am not sure how to go about writing each card.  Do I have a database of the different cards?  I have also seen a suggestion to use a scripting language like LUA to make each card.  Which is interesting, and I think I’ll do that!

Currently, I have a few menus made for this game in Unity and I have a collection of most all of the images for all the cards in the game.  I have a design document but no game code has been written yet.  I’ll keep looking into where to begin until I have a solid starting point.

Minimally, I would like for this game to be a two player game over the internet.  Ideally, I would have a single player mode similar to the old Yu-Gi-Oh games where you start with one deck, then you battle characters and win money to buy packs to get cards to make better decks.  However, those are more stretch or long term goals.

As for releasing the game, I probably wont due to legal reasons of not being associated with WIXOSS but who knows.  In fact there is already a WIXOSS fan made downloadable game out there.  But it’s not as fancy as my ambitious little project.  I am literally just doing this one for fun and my portfolio.  Expect more posts about WIXOSS the actually card game, and the development of this game in the future!