Game Development Reference
In-Depth Information
stage:addChild(obj)
return obj
end
newRectangle(10,10,200,50,1,0x0000FF)
newRectangle(100,150,250,250,1,nil, 0xFF0000)
Figure 9-13. An outlined rectangle (top) and a filled one (bottom)
Note Note that there is an issue with the preceding code. Although it gives the results expected, if
you try to reposition the rectangle, it will be a few pixels off. This is mainly because we are drawing the
lines on the shape with respect to its position. What we should rather be doing is drawing everything at
the position 0, 0 and then moving the shape to the starting x,y-coordinates.
 
Search WWH ::




Custom Search