woensdag 22 mei 2013

Rhino and his friends!


Hi!

Today im going to tell you something about making a Player script that can actually be used on anything and how to maintain a better view.  But first im happy to tell that we are working on some new projects! Together with Matthew Im working on a spin-off of a game Xform made 2 years ago.
Of course everyone knows this little fellow!

Rhino with the T-Rex
As you can see we are making this game in Unity. I've been busy with learning my way around in Unity cause mainly code in AS3. Luckily the difference between AS3 and C# isn't that big, if I compare it to lingo:)

So when I started almost a month ago I started programming with the player script. Not knowing what the project will be about or what the rhino will be doing. So I started my playerscript, like any other, basic input, assigning a model&materials, some physics,etc... Just some basic functionality.
But then there was a meeting and we decided that the rhino won't be the only that can be controlled. So now I know we will be needing a dynamic script for switching the models/materials/animations. Not that hard, we can set that in its "Init" function to let it know which prefab it's going to need.  These prefabs are perfect for us programmers, we can drag and drop it to the scene, sets its material, physic collider(box, sphere, mesh), animation(done by artist), save it as prefab and its ready for use!
But what if all these controllable objects will be having different states or lives, resets, switches..
Now comes the fun part, at least I like it. We will be needing a BasicPlayerScript that will handle some basic functionality.

  • No hardcoded links to prefabs!
  • Basic Init, get and set its paramters, and let the specific init handle the rest.
  • Float function, so we wont have collision all the time to save some performance
  • Variable movement, every object has its own speed, jump force
  • Able to receive input and handle input. Create the most common behavior and if a object is going to do something else we can override the function and let it do something else.
  • State machine! :) Handle the current state. Walk when it needs to walk, wait, jump, die, etc.. Here again, make them very common so when an object needs to do something else let it override the normal one.
  • Generic stuff.. like changing materials, reset, pickups, and if we need something specific we can easily run its original and add extra functionality if needed

This way we can easily create objects and let them use this script so we can control it. Why are we doing this, well, if we want the rhino to run and jump, same goes for a car, flamingo, rex or whatever we wont need to type or copy paste the same code over and over. And when an object needs to do something specific, instead of jumping flying, we can easily adjust in its own script instead of messing with the basic functionality. 
So when we want a rhino, flamingo or whatever we will create a script that will extend the BasicPlayerScript.

This is something you really want when you are dealing with multiple objects that have the same functionality. When there is a small adjustment it will be done for all and if you need a specific adjustment it will done its own script.

And check out our latest release 
http://www.agame.com/game/super-mud-mania.html

Greets,
Michael


12 opmerkingen:

  1. I am an avid reader who likes engaging content. That's why I am here. Your original views on this topic are refreshing and interesting. You've done a great job of expressing your views. Thank you.
    tu 95| call of duty| clicker heroes| strike force heroes 2| kitten cannon
    scooby doo games| scooby doo| brain games| braingames| brain

    BeantwoordenVerwijderen
  2. You have a real ability for writing unique content. I like how you think and the way you represent your views in this article. I agree with your way of thinking. Thank you for sharing.
    happy wheels
    super mario bros
    pacman
    agario

    BeantwoordenVerwijderen

  3. With a Hotmail account, you can send and receive emails quickly and easily as well as login and use all Microsoft services.
    hotmail login | sign in to hotmail | recover hotmail password
    This is the game so players feel very fierce , adventurous . You try to join and play this game , you will feel great like.
    strike force heroes | strike force heroes 4
    happy wheels | tank trouble 2 | slitherio
    gun mayhem 2 | age of war | can your pet

    BeantwoordenVerwijderen
  4. Life becomes more interesting and wonderful when you share your memorable moments with friends and family through unique photographs. You can create your own unique style impressed with image editing software. And after hours of work stress you can also
    dr driving, dr driving baixar ,download dr driving, dr driving

    BeantwoordenVerwijderen
  5. You need to have time to take care of the active. It in fact was a amusement account it. Look advanced to far added agreeable from you.

    banana kong download , banana kong , baixar banana kong , download banana kong , banana kong baixar

    BeantwoordenVerwijderen
  6. Mostly people have all the same things when they are writing academic task or any other writing, especially light music most people like during the writing.
    dream league soccer download , dream league soccer apk , download dream league soccer , dream league soccer

    BeantwoordenVerwijderen
  7. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you must watch this video
    right away...

    (VIDEO) Win your ex back with TEXT messages?

    BeantwoordenVerwijderen
  8. I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job! In my free time, I like play game: superfighters2.net. What about you?

    BeantwoordenVerwijderen
  9. Thanks for sharing the information. It is very useful for my future. keep sharing

    sushi-cat2.com

    BeantwoordenVerwijderen