Forum > C++ > stop auto animate setPosition on ccsprites

stop auto animate setPosition on ccsprites

By abeazam Posted 2012-07-06 12:40 Comments 5
abeazam
  • Posts: 7

EDIT** using cocos2d-x 2.0

i am positioning a bunch of ccsprites in a cclayer

for some reason when i do this it animates them to that location rather than instantly positioning them

i dont want them to animate in ideas on y it is doing this and how to stop it

JeffreyWalraven
  • Posts: 27
  • Location: U.S.A.

#1 RE: 2012-07-10 01:33

Can you show your code?

abeazam
  • Posts: 7

#2 RE: 2012-07-10 07:40

Jeffrey Walraven wrote:

Can you show your code?

EDIT*** using cocos2d-x 2.0
this runs in a ccsprite
@
string start = “bg”;
string end = “.png”;
string fileName;
CCSprite**tempS;

for(int i = 0; i <4; i**)
{
fileName = start* Utils::num2str* end;

tempS = CCSprite::spriteWithFile(fileName.c_str());
tempS~~>setAnchorPoint);
tempS~~>setPosition(ccp(0, tempS->getContentSize().height*(i)));

addChild(tempS);

bg_on.push_back(tempS);

}
@

JeffreyWalraven
  • Posts: 27
  • Location: U.S.A.

#3 RE: 2012-07-11 19:21

That is weird, because it doesn’t do that for me. What is “bg_on”? Are you updated to the latest version of cocos2dx 2.0?

abeazam
  • Posts: 7

#4 RE: 2012-07-12 07:36

Jeffrey Walraven wrote:

That is weird, because it doesn’t do that for me. What is “bg_on”? Are you updated to the latest version of cocos2dx 2.0?

its a vector of CCSprites

well i am currently just putting a delay in before it starts.

abeazam
  • Posts: 7

#5 RE: 2012-07-12 19:11

thx for all the help jeff…i just figured it out.

i was transition into the game scene with:

pDirector->pushScene(CCTransitionSlideInB::transitionWithDuration(1.0f, Game::create()));

so it was sliding from the top of the level down to the bottom which made it look like it was the backgrounds that were moving. you could say it was like the perspective of the camera was panning down.

it became obvious once i started to add furniture to the page

DOH!

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps