Which elements will be rendered in the game?
The last three elements can be grouped together as a background. So let us do just that:
OnUpdate
method and the OnRender
method, create a new method called DrawPlayField
.Method OnUpdate:Int() Return True End Method DrawPlayField:Int() 'Draw the top wall with a rectangle DrawRect(0,0,640,5) 'Botton wall DrawRect(0,475,640,5) 'Middle line, 13 pieces, each 10 pixel long For Local i:= 5 To 465 Step 20 DrawRect(318,i,4,10) Next Return True End Method OnRender:Int()
OnRender
method now, so that the new DrawPlayField
method can be called.Method OnRender:Int() Cls 'Clear the canvas each frame DrawPlayField() 'this call draws the background Return True End
Pongo_03.Monkey
file. You should now see a screen that looks as follows:3.140.195.225