How to update children?
noob question :D
(8 posts) (5 voices)-
Posted 1 year ago #
-
You need to be a lot more clear on what you are trying to do.
Posted 1 year ago # -
How to update children?
Talk to your wife, I am sure she has some ideas
Posted 1 year ago # -
-(void) addPlayer:(NSString *)PID PName:(CCSprite *)PName Px:(int)Px Py:(int)Py Pw:(int)Pw Ph:(int)Ph PDir:(int)PDir PFrame:(int)PFrame xTiles:(int)xTiles yTiles:(int)yTiles
{int PoffsetX = Pw/xTiles;
int PoffsetY = Ph/yTiles;PName = [CCSprite spriteWithFile:PID rect:CGRectMake(((PFrame-1)*PoffsetX)
, ((PDir-1)*PoffsetY)
, PoffsetX
, PoffsetY)];PName.anchorPoint = ccp(0,0);
PName.position = ccp(Px,Py);[self addChild:PName];
}
want to change the direction of the char
[self addPlayer:@"Player.png" PName:Player Px:0 Py:0 Pw:96 Ph:128 PDir:X PFrame:1 xTiles:3 yTiles:4];
now i change the var X at PDir:X to an other value and i want that the image should change but nothing happens
how to solve?
Posted 1 year ago # -
how to solve this?
Posted 1 year ago # -
Are you storing a reference to the player in your layer/scene? The code you posted appears to add a new sprite every time you want to change it (instead of modifying the sprite you already added).
You probably won't get many responses (especially from me), because you keep asking questions which would be obvious if you took a look at the links we've posted for you (examples, tutorials, etc).
Posted 1 year ago # -
i have readed all the examples and tutorial and didn't understand them
i know what my function does my question was how to say the function to show the changes when i change the variables by runtime
Posted 1 year ago # -
i have readed all the examples and tutorial and didn't understand them
i know what my function does my question was how to say the function to show the changes when i change the variables by runtime
Posted 1 year ago #
Reply
You must log in to post.