cocos-Lua 中的getPosition()

来源:互联网 发布:sql 查询表的列名 编辑:程序博客网 时间:2024/05/22 07:55

LUA中的getXX事件:

    getPosition()             -- 返回两个值:x y
    getAnchorPoint()      -- point_table
    getContentSize()      -- size_table
    getBoundingBox()   -- rect_table

其中,要注意的是getPosition(),其他的都可以直接赋值给表,这是一个大坑

getPosition() --返回的是x,y两个值

接受后处理

    -- 方法一 : 用两个变量接收
    local x, y = sprite:getPosition()
     
    -- 方法二 : 转换为point_table
    local p = cc.p(sprite:getPosition())

0 0