Time for action — detailing the OnRender method

We can detail the OnRender method as follows:

  1. We start by adding the Cls statement to clear the screen before we render anything.
    Method OnRender:Int()
    Cls
    
  2. Next, call the Render method of the fantomEngine, which is stored inside the eng variable.
    eng.Render()
    Return 0
    End
    
  3. Save the script again and now actually try to run it. You should see a basic black canvas in the browser.

What just happened?

With one simple call to the Render method of the fantomEngine, we have rendered every single object that was active and visible. By using this framework, you won't need to think about rendering your game objects anymore. Cool isn't it?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.186.109