Odd outcomes with MoveTo?

Ello there, I’m experiencing some trouble getting something set up, and I’m not sure what the fault is. My code is as follows:

for(int i = 1;i <= DECKSIZEMAX; i++)
	{
		if(CD < 1){CD = 1;}
		if(i==1)
		{
		buttons.at(colDBH + CD)->setScale(buttons.at(card)->getScale());
		buttons.at(colDBH + CD)->setPosition(buttons.at(card)->getPosition());
		buttons.at(colDBH + CD)->getRendererNormal()->setTexture(buttons.at(card)->getRendererNormal()->getTexture());
		deckBuilder->addChild(buttons.at(colDBH + CD));
		buttons.at(colDBH + CD)->runAction(ScaleBy::create(0.1f, 0.1666f));
		};
		buttons.at(i + colDBH)->runAction(MoveTo::create(1.0f, Vec2((WindowSize.width/(CD + 1)) * (i), WindowSize.height/15 * 3)));
	}

What I am trying to do is, when a card is clicked [not shown] it will expand to the screen size [not shown]. After there will eb the option to right or left click. Left clicking activates the line of code shown. The problem is that MoveTo is not functioning as expected, and I know not why.

After the first click cycle, it works as intended [first image].
After the second click cycle, and this repeats with every new card after, the card floats off the screen to the right. I do not know why.
On the third click cycle, as well as with every subsequent cycle afterword, the second card goes to its intended place while the third continues to the undesired place previously regarded.

For further curiosity, I isolated particularly the y function and found peculiar results pertaining to the position - the y value was going up to an unintended spot and returning as previously stated. However, the y distance from the requested location increased with every new cycle, despite being a concrete, static function.

For further word on a certain variable not listed here, CD is the count of the click cycles, always beginning with 1.



Your code image isn’t showing. Can you paste it as text please using a code block.

It was already as text, it just had a large tab interval. I have fix it.