Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. Game #7, Air Dogs 1942 > Time for action — first changes to the OnCreate met...

Time for action — first changes to the OnCreate method

Time for action — first changes to the OnCreate method Inside the OnCreate method, we want to determine the canvas size and load the sprite sheet and the game font. This is done as follows: Set the virtual canvas size to 800 by 600 pixels, as the background image is of the exact same size. Method OnCreate:Int() SetUpdateRate(60) eng = New engine eng.SetCanvasSize(800,600) Determine the canvas size and store the values in the fields we just created in the preceding section. You code set them with hard values, but this approach makes them more modular. ch = eng.canvasHeight cw = eng.canvasWidth Now, load the sprite sheet and store the reference in the atlas field. atlas = LoadImage("ad_Tiles.png") And lastly, load the bitmap font. font1 = eng.LoadFont("ad_font") Return 0 End What just happened? The first modifications that we have just made in the OnCreate event will prepare the project as far as the canvas size, loading the graphics, and font we will use are concerned.

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint