In my game i am using tile map and sneaky joystick and I want to perform following task in my game.I am using box2d in my game.
I am create sprite body using box2d and also create static body for tile map.
My main problem is when my sprite moves that time tile map can not scroll.
Please help me.
Thanks
I am not sure what code you are using for your joystick but, Here's what I used when I made use of joystick for my game. Its very simple to use and easy to understand.
Hope that help you.. ! :)
Related
I am new to cocos2d-x and i am developing a game using cocos2d-x in xcode. In my game I added player sprite and Obstacle sprite. Obstacle sprite is moving continuously from right to left.
Now i am trying to add collision between the two sprites. So that I am using bounding box.Following is my code. but it is not working. this is first time that i am using bounding box.
if(obs1->boundingBox().intersectsRect(man->boundingBox()))
{
obs1->stopAllActions();
}
I created both the sprite in init() function and declare the above code in init function. Please help me to solve this.
you should be using if xxx->containsPoint()
I am trying to create a simple game that mainly consists of a ball rolling down an incline. The player's only control is to cause the ball to jump. My question is, what is the best way to make it appear to roll while generally keeping the ball at the same place on the screen? I have considered CCCamera, but it seems like it's not the best option since I want a repeating background image. Scrolling the background manually is also giving me trouble because it's not clear how to get the ball to stay in one place while letting Box2D handle the physics. I'd appreciate any help as I've been stuck on this for quite a while.
Use CCFollow on the layer where you draw the game stuff, and let it follow the ball sprite:
[gameLayer runAction:[CCFollow actionWithTarget:ball]];
in cocos2d I need to drag a sprite in my project using finger. how do i get hold of that sprite? any help will be appreciated. thanx. i am using chipmunk engine.
You need to capture the touch began, work out what sprite is being touched and then track the movement of the touch. In touches moved you update the position of the sprite.
Sound complicated? It's not really. Here is a great tutorial for it.
http://www.raywenderlich.com/2343/how-to-drag-and-drop-sprites-with-cocos2d
I am using a tile map+cocos2d+ box2d based game and i have a some issue that how to move randomly enemy body with randomly force in tile map??
Please any one know tell me..
Thanks
I am using box2d based game and i want to detect collision between my sprite body and edge body. I know use of b2Contactlistener in this tutorial but i want to use contactlistener in simplest form.
Is any one know than help me.
Thanks
This has a simple example (same site): http://www.raywenderlich.com/28606/how-to-create-a-breakout-game-with-box2d-and-cocos2d-2-x-tutorial-part-2