cc官网教程 一堆堆问题~快无语了~ 都不更新~

参考地址:http://cn.cocos2d-x.org/tutorial/show?id=1260

local Player = class(“Player”, function()
local sprite = display.newSprite("#player1-1-1.png")
return sprite
end)

function Player:ctor()

self:addAnimation()

self.fsm_ = {}
cc.GameObject.extend(self.fsm_)
    :addComponent("components.behavior.StateMachine")
    :exportMethods()

self.fsm_:setupState({
    -- 初始状态
    initial = "idle",

    -- 事件和状态转换
    events = {
        -- t1:clickScreen; t2:clickEnemy; t3:beKilled; t4:stop
        {name = "clickScreen", from = {"idle", "attack"},   to = "walk" },
        {name = "clickEnemy",  from = {"idle", "walk"},  to = "attack"},
        {name = "beKilled", from = {"idle", "walk", "attack"},  to = "dead"},
        {name = "stop", from = {"walk", "attack"}, to = "idle"},
    },

    -- 状态转变后的回调
    callbacks = {
        onidle = function () print("msg_lyywhg: ~" .. "idle") end,
        onwalk = function () print("msg_lyywhg: ~" .. "move") end,
        onattack = function () print("msg_lyywhg: ~" .. "attack") end,
        ondead = function () print("msg_lyywhg: ~" .. "dead") end
    },
})

end

function Player:addAnimation()
local animationNames = {“walk”, “attack”, “dead”}
local animationFrameNum = {4, 4, 4}

for i = 1, #animationNames do
    local frames = display.newFrames("player1-" .. i .. "-%d.png", 1, animationFrameNum*)
    local animation = display.newAnimation(frames, 0.2)
    display.setAnimationCache("player1-" .. animationNames*, animation)
end

end

function Player:doEvent(event)
self.fsm_:doEvent(event)
end

function Player:walkTo(pos, callback)

local function moveStop()
    transition.stopTarget(self)
    if callback then
        callback()
    end
end

local currentPos = cc.p(cc.Node.getPositionX(self), cc.Node.getPositionY(self))
local destPos = cc.p(pos.x, pos.y)
local posDiff = cc.pDistanceSQ(currentPos, destPos)
local seq = transition.sequence({cc.MoveTo:create(5 * posDiff / display.width, cc.p(pos.x,pos.y)), cc.CallFunc:create(moveStop)})
transition.playAnimationForever(self, display.getAnimationCache("player1-walk"))
self:runAction(seq)
return true

end

function Player:attack()
transition.playAnimationOnce(self, display.getAnimationCache(“player1-attack”))
end

function Player:dead()
transition.playAnimationOnce(self, display.getAnimationCache(“player1-dead”))
end

return Player

报错:
2015-03-05 10:44:59.730 player3 NSConcreteAttributedString initWithString:: nil value**

先检查下引擎版本吧,那个教程是2.2.5的

呵呵,这篇文章我看过,很有帮助。像我这种小白都知道,教程都是有对应的引擎版本的,所以楼主还是自己先检查版本整清楚没有、环境整好没得再发帖抱怨吧。教程又不是文档,写都写完了还要怎么更新。:12:

sorry
:10: :10:

sorry
:10: :10:

http://cn.cocos2d-x.org/tutorial/show?id=1260
这个教程的第一篇,第二篇~偶在quick 3.3上已经修改好了~
但是
状态机这块不知道怎么的 只要添加了self.fsm就报:NSConcreteAttributedString initWithString:: nil value