I'm working on an iPhone game using box2D and I need to implement horizontal scrolling... I was able to scroll the background textures and all... But, the problem is that, I'm not able to scroll the physics world of box2d... Please help me, how to move the box2d world... I'm not using cocos2d... I googled a lot, but was not able to find any solution without cocos2d...
Regards,
Suran
You should not move the world. Instead, try moving the "camera" (clip area) accordingly with the game character.
Try following: in touchesEnd Method:
[self.parent runAction:[CCMoveTo actionWithDuration:.5 position:ccp(yourPosition,0)]];
Related
I want to fly b2bodies with in the entire screen randomly. Now I'm using ccMoveTo but it does not look soo good. Can anyone tell me if there is any easy method to move without using ccMoveTo or ccBazierTo?
The example game http://www.agame.com/game/chickaboom.html
Thanks in advance
You can use this code
body->setlinearvelocity(b2vec2(randomNumber1, randomNumber2));
I am going to create simple iPad game, in which arrow going to hit balls. Where balls are moving in random direction with random speed. When arrow hits ball there is blast like animation with sound (Collision detection is main thing here). So for this what should i prefer. Should I use simple UIImageView and animation or use COCOS2D. Also I am new to COCOS 2d. Any other options are also appreciated. Thank You.
Use cocos2d Animation .Refer below link
if u have spritesheets try this:
1) http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d
or u have separate images refer this:
2) http://cocos2d-iphone.org/wiki/doku.php/prog_guide:animation
Using cocos2d has a lot od advantages over UIKit. One of the things is box2d which will be very helpful for game like this [at least I got this impression for your question].
Do some research about box2d collision detection.
I am working on a game in cocos2d. The game has multiple sprites coming on the screen. I would like to change that items direction ato the direction a swipe and the speed to how fast i swipe . Does anyone know how i can do this?
Kobold2D (improved Cocos2D) will have built-in gesture recognition starting with Preview 5.
UISwipeGestureRecognizers sort of do what you are asking, although you are limited on the directions you can use. If you want to implement any direction, simply make some code that figured out the direction and speed in the touchesMoved: method. This is a great tutorial on how to get the direction, and also has code which you can modify to get the speed. Simply get the distance and see how long it took to get there, and that gives you the speed. Hope that Helps!
If you want to do it without the gesture recognizer, here's a simple D.I.Y solution: http://www.cocos2d-iphone.org/forum/topic/7925
Please excuse the stupid question, but I'm working on a game because I'm crazy like that and I really need some help. When you fall below the screen in doodle jump the game is over and it cuts to end of game animation. This animation gives the feel of the screen scrolling and him falling -- some how they animate him to the top -- from the top to his death. Do anybody know who to simulate this animation? BTW, I'm using Cocos2d for the game engine.
I did find the answer my self by using this tool called File Juicer. Check it out it very good.
Newbie in XCode & IPhone development.
I'm trying to create a game, where throwing an object (using a swipe gesture) will move the object to the direction requested and will continue with momentum until the border of the view.
Anyone has some code snippets (or links) I can look into for examples?
Thanks.
Take a look at cocos2D-iphone for animation and physics.