1

I'm facing some difficulties in the design of my first cocos2d game and I'd really appreciate your help.

The game is basically a side-scroller and the hero (on a skateboard) runs into different paths (linear, circular, curvy, .. etc) as drawn in this sketch:

http://www.legendstyler.com/cocosq.jpg

Here are my questions:

  1. What is the best approach for drawing paths and letting a sprite follow them (especially circular paths) ?

  2. If I'd like the jumping and landing to look realistic, do I need to use a physics engine ? will it make my life easier in collision detection or following paths ?

Please note that I'm going to place the paths in random order and distances. I'm not planning to draw a level with fixed elements.

Many thanks and have a good day =)

1 Answer 1

0
  1. Should the player draw the line that the character should follow, or are you talking about an imaginary line?

If that should be an imaginary line, then you could calculate it using cos and sin. If the player should draw it, then you might use an array to store the x,y coordinates.

  1. You might use box2d. After you've set up everything (the world with it's objects) you will get a lot of stuff (such as bouncing and collision). But the movement is a bit trickier, because you will have to use forces to move objects, instead of just "moving" them pixel for pixel. For example, if you would like to move your character to the right, you will have to push him.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.