Help on good theory / logic for complex scrolling terrain using sprites

Hi peps ive made a good scrolling shooter for my first game, now I have a good idea on what I need to do but thought get some other peoples thoughts on how to create some scrolling terrain based on sprite sheets.

Now I have not mastered sprites this is where my knowledge is weak.

I have created a sprite sheet with 20 50x50 images of a edge of a mountain, each sprite will seamlessly join on the Y axis perfectly at the same position.

Now I will drop sprites every 50 pixels as my level scrolls and move the dropped sprites, this is the easy part.

Now the part im unsure on is the collision detection, should I:

1.make each sprite a dynamic body, does the sprite api allow this easily
or
2. be trying to make one big physics shape the covers all the sprites that define my edge/terrain. Possibly updating the shape on every 50 pixels worth of scrolling when a new sprite is added/removed offscreen?

Would love to know if any one has done this well, I could easily make a straight Y limit to define my cliff edge/terrain but feel that it im losing the beauty of collision shapes.

THX

[import]uid: 118379 topic_id: 25420 reply_id: 325420[/import]

Hey there,

To answer your first question, I don’t think it’s the Sprite API you are looking for to do the collision detection. You need to make the tile a static physics body to detect collision. Simple collision will be a box or circle but a complex one will require you to code the shape of the collision which really will take lots of time.

Here is a link to the physics API.
http://developer.anscamobile.com/reference/index/physics-engine

Personally, i did prefer to use 3rd party tools like Physics Editor or Sprite Helper which helps you trace complex physics shapes. I feel these will cut down on your time by a whole lot without having the need to feel frustrated trying to work things out. Well worth the money and doesn’t cost a lot. You should really consider purchasing 1 to help save you time. [import]uid: 39846 topic_id: 25420 reply_id: 102714[/import]

thx for reply, got there in the end using texture packer. Then used the new image sheet api within a imagegroup. Works great as you mentioned just created a physics shape for each sprite. [import]uid: 118379 topic_id: 25420 reply_id: 102955[/import]

Cool! :slight_smile: Glad you found something that works for you. [import]uid: 39846 topic_id: 25420 reply_id: 106981[/import]