Moving sprite on a predefined path using ccTouchesMoved - iphone

I am trying to move the sprite on the path which I define for, by Moving the touch. But I am unable to exact same as the CCCatmullRomBy Action which is predefined in cocos2D. Please suggest me how would I do it.
For more understanding lets assume a car having a road and I want to move the car using touch on the road. The road is zig zag like CCCatmullRomBy with tension 0
Thank you in advance.

Related

Detect collisons only on the border of a collider,How to detect collisions only on the border of a collider but not inside?

I am creating a 2D game and I want to implement two game objects with circular colliders to detect collisions following say an object is travelling from Point A to Point B then -
See the image for details
Thanks for the help
I think the easiest answer is to just make a polygon collider 2D that looks like a ring, like so but without the gap and much thinner:
Then you can use OnTriggerStay2D to run the code you'd like to run on collision.

Side scroller style scene with gravity

I've started learning sprite kit and I think I've got the basics but now I'm struggling with something.
I want to create a game that has a 'Streets of rage' type feel to it whereby the user can move up and down, but isn't jumping, they're still on a 2D plane. But I also want them to be effected by gravity e.g stairs etc. like the following picture.
Am I right in assuming that I should have my background image with colliders around the blue and brown edges, and then create a physicsbody collider located at the feet of my player/players so that it looks like they can move against the background, but when their feet reach the top it would stop?
Could I then place other obstacles like rocks etc on that path that they would be able to collide into, but that could also sit over the path and the sky? How would I handle the fact that these could be constantly colliding depending on the position?
I appreciate there isn't any code here, but I'm trying to understand the concept around this before I jump in coding a solution.
Thanks
I would use a categoryBitMask to separate the different planes of objects.
And I would play with collisionBitMask/contactTestBitMask depending from the plane the player is in, in addition to the z-order.
Thus you can have a rock that collides your player if they are both in the same line else the player would walk behind/front.

Can A* Pathing in AndEngine allow a sprite to determine "incorrect" paths and make "random" choices?

I am currently developing a Tower Defense game for the Android platform using the AndEngine. My enemies (animated sprite extended class) have hard coded pathing. I'd like to switch to something better where the enemies can determine for themselves where to go. I am using TMX maps. Please refer to the following map:
The 2 hexagonal tiles are spawn locations for the enemies. I have 2 questions abou A* Pathing.
At point A is it possible to make sure the enemy doesn't turn down the path towards the other spawn location?
From what I've been told A* Pathing looks for shortest distance, so is there a way to have the enemy randomly select which way to go at point B?
If A* Pathing is sufficient for these test cases, can you supply me a link to a tutorial/example? I haven't found much help through Google.
If A* Pathing can't do this, what are my other options?
In order to use A*, you need to know where the enemy is trying to get to. If you randomize the target locations of the enemies between the two exit points at the right, they should work correctly.

Create a space environment with no gravity, Box2d or not?

I want to create a cclayer with 4-5 flying objects, flying in random directions on screen. I also want those flying objects transparent to each other, which means they can fly through each other.
What I can think of Ways to do:
With Box2D
Create a box2d world with 0 gravity. and add Polygon static ground around the edges of the screen.
Give an initial force to each of the flying objects, let them flying around and reflect on the grounds.
Problems: Objects still rest down after sometime.. Don't know why. Objects collide with each other, don't know how to make them fly through each other.
Without Box2D
use CCMove for each objects, detect if they reach edge of the screen, calculate new path for their move..
Can someone point me a direction, which way is easier? Thanks a lot.
If you have to handle complex collisions - go with Box2d. If your collisions are simple - handle them yourself.

Problem in using CCCamera

I am going to work on a game project. I am using cocos2d. I want to use cccamera class of cocos2d. Please tell me about any tutorial on cccamera. I want to implement more or less like angry birds, throwing the ball that reaches its destination facing the obstacles in the way.
So when the ball moves ahead the scene accordingly moves back depending on speed of the ball.
How to manage all that. I think i should use cccamera.
Thanx.
CCCamera, per the documentation is used for 3D effects (http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_camera.html) and recommends the use of CCFollow (http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_follow.html) for 2D related effects (such as following the birds forward, etc).