O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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?

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required