bomb = [[Sprite spriteWithFile:@"bomb1.png"] retain];
and i have a bomb2.png,
I want to change Sprite's PNG from bomb1.png to bomb2.png in run time,
How to do it?
A fast, easy to use, free, and community supported 2D game engine
bomb = [[Sprite spriteWithFile:@"bomb1.png"] retain];
and i have a bomb2.png,
I want to change Sprite's PNG from bomb1.png to bomb2.png in run time,
How to do it?
try:
bomb.texture = [[TextureMgr sharedTextureMgr] addImage: @"bomb2.png"];
hth, Codemattic
animation = [Animation animationWithName:@"BallOrange" delay:1.0f];
[animation addFrameWithFilename:@"BallOrange.png"];
[m_sprite setAnimation: [animation];
I store a bunch of animations in a singleton and grab them like this:
[m_sprite setAnimation: [[SharedData singleton] getBallAnimation: innum]];
-(Animation*)getBallAnimation: (int)innum
{
if(m_ballAnimArr)
{
return [m_ballAnimArr objectAtIndex: innum];
}
else
{
assert("trying to get ball anim before initialization\n");
return nil;
}
}
thanks,
bomb.texture = [[TextureMgr sharedTextureMgr] addImage: @"bomb2.png"];
is good!
You must log in to post.