This is a rather broad question, unfortunately, which makes the answer difficult in any final terms. If you are hoping to create real platforms to which you can bounce (in the transition mode to scribble), you will need to implement collision detection between monsters and ccNodes platforms. There are many online training applications for cocos2d conflict detection, both simple implementation and more advanced 2d / chipmunk solutions.
If you want to clone doodle jump pretty fast, there is an open source version of the clone available on github here - although I didn't really look at the code.
Finally, if you mean that you just want to limit the movement of monsters in a certain area of the screen (so that they do not run off the edge), you just need to put the target in the area on and change ccAction so that ccMoveTo uses the ccMoveTo part of the "platform" as the most distant point to which he could go, and the right of the last point as the farthest right. (I admit, I did not play Doodle Jump, so I don’t know what the enemies actually do).
If enemies are running back and forth across the platform, you should examine ccRepeatForever in your sequence of movement and have two destination positions in CCSequence : one that moves the monster to the left of the platform, and the other to the right.
Additional Information
Ok, I see what you are trying to do. This should start:
Platforms are created in initPlatforms . This calls initPlatform several times. This captures an image from AtlasSprite for the platform, creates ccSprite for each platform, and assigns it a unique tag.
Then at - (void)step:(ccTime)dt it goes through all the platforms and moves them to the right place depending on how far the bird moved:
for(t; t < kPlatformsStartTag + kNumPlatforms; t++) { AtlasSprite *platform = (AtlasSprite*)[spriteManager getChildByTag:t];
So, the bit you expect:
If you want to add a monster to these platforms, you will have to follow a similar pattern. To get started, try something like this (you need to have a cleaner design than this, but it should put you on the right track)
in initPlatform add at the end of the function
following:
(I just grabbed an image from an existing Atlas. You could replace the “Monster” sprite object described above. Notice, I add 1000 to the currentPlatformTag . It's just for testing, you should have a monsterTag in the end.
So, now there is a “monster” on each platform (again, you only need to target random platforms) so we need to update the positions for the monsters.
B - (void)step:(ccTime)dt immediately after receiving the current platform
AtlasSprite *platform = (AtlasSprite*)[spriteManager getChildByTag:t];
Now you also need to get the current monster (remembering to use the updated tag value that we created for the "monsters":
AtlasSprite *monster = (AtlasSprite*)[spriteManager getChildByTag:t + 1000];
Then, a few lines below, where we move the platform, we will need to move the monster
platform.position = pos;
So, now on every platform there is a monster whose position y moves with the platforms :-) Hope this helps