How to move background in cocos 2d

Hi, I want to develop a game like "Doodle jump". But I have some problems with the following functions -

1.How to move the background scene / image.

2. How to detect a collision between an object. He needs a physics engine like box2d or I just have to use manual collision.

3. What should be the size of the background image.

4. Actually, I have no idea how the background moves. So I need an explanation from someone.

+3
source share
3 answers
  • Background motion A) You can create a TMX Tilemap and then make a very tall Tiled-Map. B) You can create one texture and then encode texture coordinates, rather than moving it.

  • . "Point in Boundingbox" "Rect in Rect". cocos2d: http://www.anima-entertainment.de/?p=262

  • , 2 . (960x640 ), 1024x1024. . (, 512x512). TMX.

  • CCTMXTiledMap * tmxNode = [CCTMXTiledMap tiledMapWithGMXFile:@"Level.tmx"];

    // lets say you want to move it 50 pixels down in 1 second :

    [tmxNode runAction:[CCMoveBy actionWithDuration:1.0 position:ccp(0,-50)];

    tilemap: http://www.mapeditor.org/

+4

cocos2d tilemap. TileMapTest.h TileMapTest.m

0
0
source

Source: https://habr.com/ru/post/1779348/


All Articles