![]() (sprite) // This Sprite Object added to display list. Sprite.pivotY = 0 // Set up Sprite Vertical method of object, axis point coordinates. Sprite.pivotX = 0 // Set up Sprite The horizontal method of object axis point coordinate. Sprite.y = 200 // Set up Sprite The vertical coordinate value of the object relative to the parent container. Sprite.x = 200 // Set up Sprite The horizontal coordinate value of an object relative to the parent container. Sprite.loadImage("resource/ui/bg.png") // Load and display pictures. Sprite = new Sprite() // Create a Sprite Class instance object Sprite. = "#efefef" // Sets the background color of the canvas. Laya.init(640, 800) // Set the game canvas wide and render mode. Sprite For different circumstances to do the rendering optimization, so that a class to achieve rich functions, but also to achieve high performance. ![]() There is only one core display class Sprite. ![]() So there's no need to set it manually mouseEnabled. Sprite Default does not accept mouse events, that is, mouseEnabled=false But as long as you listen to any mouse event, you automatically open yourself and all the parent objects mouseEnabled=true. If you need to change the display image size, use the scaleX, scaleY, scale. Sprite The width and height are generally used for collision detection and typesetting without affecting the display image size. Sprite It is also a container class that can be used to add multiple child nodes.īe careful: Sprite The default is not wide enough to pass getBounds Function acquisition can also manually set width and height can also be set autoSize=true And then get the width high. adopt graphics You can draw pictures or vector graphics, support rotation, zoom, displacement and other operations. Sprite Default is not wide and defaults to mouse events. Sprite Is the basic display list of graphical display nodes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |