Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md

README.md

My javascript library open source!

What are the plans:

  • ES5 and ES6
  • Draw objects layered
  • Framework loader

How to use the Behaviours:

Recommended:

  • Check the html files and read the comments.
  • Download the files you need.

The mtmin.js:

  1. you need to have a canvas in your html page add it somwhere:
    <body>
        <!--Your page-->
        <canvas id="yourCanvas" width="300" height="300"></canvas>
        <!--Your page-->
    </body>
  2. create in your html file a div with the id "mtdef" at bottom of your body:
    <body>
        <!--Your page-->
        <canvas id="yourCanvas" width="300" height="300"></canvas>
        <!--Your page-->
        <div id="mtdef">
        </div>
    </body>
  3. create in the div id "mtdef" the mtmin.js file, you can use the online or local:
    <body>
        <!--Your page-->
        <canvas id="yourCanvas" width="300" height="300"></canvas>
        <!--Your page-->
        <div id="mtdef">
            <!--example-->
            <script src="Lib/Behaviours/mtmin.js"></script>
            <!--local-->
            <script src="Your/Local/Files/mtmin.js"></script>
        </div>
    </body>
  4. now add your js file below the mtmin.js I called it Main.js for now:
    <body>
        <!--Your page-->
        <canvas id="yourCanvas" width="300" height="300"></canvas>
        <!--Your page-->
        <div id="mtdef">
            <script src="Lib/Behaviours/mtmin.js"></script>
            <script src="Main.js"></script>
        </div>
    </body>
  5. open your Main.js file and follow the next instructions:
    1. add the Start function like this: function Start() {}
    2. add the Update function like this: function Update() {}
    3. add the Behaviour function Awake like this: Behaviour.Awake(); Now you are using the standard settings of Behaviour
    4. if you don't want to use the Start function set the parameter false like this: Behaviour.Awake(false);
  6. if you want to use the built in Debug canvas follow these instructions:
    1. set the Behaviour.Awake(); to: Behaviour.Awake(true, true); if you use the Start function or Behaviour.Awake(false, true); if you don't the Start function
    2. try to run it you get some info and warnings in your console and screen.
    3. remember you have to arrange your own keys

The mtcore.js:

  1. follow the steps of mtmin.js but replace the:

        <script src="Lib/Behaviours/mtmin.js"></script> 
     with 
    
        <script src="Lib/Behaviours/mtcore.js"></script>
  2. add In your Update function the following:

    if (Input.GetKeyUp(KeyCode.Space)) { Debug.log("Space pressed"); }
    if (Input.GetKeyDown(KeyCode.V)) { Debug.log("V released"); } 
    if (Input.GetKey(KeyCode.B)) { Debug.log("B pressing") }
  3. have fun using Note: notice the Debug.log instead of console.log Add in the Start function Debug.On() and you see in top left: * the width and height * the runtime * the fps * the ms per frame (mspf) ps: You can use Debug.Log();

The mtdef.js:

  1. follow the steps of mtmin and mtcore but replace the:

        <script src="Lib/Behaviours/mtmin.js"></script>
     or
    
        <script src="Lib/Behaviours/mtcore.js"></script>
     with 
    
        <script src="Lib/Behaviours/mtdef.js"></script>
  2. read all the code and tweak it a bit to your project

  3. follow the license and please credit me