摘要:
function cc.exports.findValueByTbl(tbl,key)--递归方法,用于查找tbl中对应的键值 for k,v in pairs(tbl) do if k == key then if type(tbl[i])=="table" then--如果是t... 阅读全文
摘要:
-- 参数:待分割的字符串,分割字符 -- 返回:子串表.(含有空串) function split(str, split_char) local sub_str_tab = {} while true do local pos = string.find(str, split_char) if n 阅读全文
摘要:
function cc.exports.VerticalVector(vec)--求出两个垂直向量 local result = {} result[1] = cc.p(vec.y/vec.x,-1)--向下方向 result[2] = cc.p(-vec.y/vec.x,1)--向上方向 ... 阅读全文
摘要:
cc.exports.LineCollideRect(startLine,endLine,rect)--向量与矩形检测碰撞 --获取矩形的四个顶点位置 local p = {cc.p(rect.x,rect.y),cc.p(rect.x + rect.width,rect.y),cc.p(rec... 阅读全文