hello.lua - can't play animations

Hello everyone,
I’ve just started with Cocos2DX and Lua; fist thing I did was running hello.lua (XCode, IOS/IPhone simulator).
Everything seems to be working fine, but I can’t get the sprite to animate properly (it should be running a 2 frames animation).
Any help? I’ve tried everything I could come up with, but not luck yet.
Thanks!

TestLua is added in cocos2d-2.0-x-2.0.2, you can refer to corresponding test case.

I ran TestLua in Android as well. The same error as Morga.

change
local animation = CCAnimation:create(animFrames, 0.5)
to
local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.5)

CCAnimation:create does not exist with 2 parameters.

Andre

This is another correction.

also
local animFrames = CCArray:create(2)

should be
local animFrames = CCArray:create()

CCArray does not take any parameter.

Cool. The interesting thing about lua is it does not complain if you add more parameters than it needs.

You got the same results as below:

— file: hello.lua

function hello()
print(“hello, world”)
end

hello()
hello(123132)


~$ lua hello.lua
hello, world
hello, world

Andre Arpin wrote:

change
local animation = CCAnimation:create(animFrames, 0.5)
to
local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.5)
>
CCAnimation:create does not exist with 2 parameters.
>
Andre

Exactly! if i’ve seen your words earlier i wouldn’t have spent hours for that…

stanley cai wrote:

Cool. The interesting thing about lua is it does not complain if you add more parameters than it needs.
>
You got the same results as below:
>
— file: hello.lua
>
function hello()
print(“hello, world”)
end
>
hello()
hello(123132)
>
—-
~$ lua hello.lua
hello, world
hello, world

I also want to complain about that. it makes it much harder to find the errors. any good way to avoid extra params like CCArray:create(3)?