I'm developing a chinese kite flying game,I want to attach a string to my kite.
What can be the best approach of implementing a string in andengine?
Andengine uses box2D physics. It contains a RopeJoint. Depending on your game play this may give you the sort of simulation you want. Of course getting ropes to act like kite strings and looping around each other is something you'll have to decide for yourself.
Related
I'd like to implement a (physical) string with a weight in iOS, that reacts to accelerometer input and colides against the view bounds.
What is the simplest way to do this? I would prefer to avoid using external frameworks like Box2D, unless of course a native solution is too complicated.
If you need it to accelerate under gravity and bounce realistically when it hits the edge, you'll need to use a physics framework (unless you feel like getting out a physics book and doing the equations yourself) as there's nothing like that built into UIKit.
I'd recommend you try Chipmunk instead of Box2D. I've found it easier to use with Cocoa as it's pure C and not C++. It also has an Objective-C wrapper, but the developer charges for it (the plain C library is free).
Here's a simple iPhone Chipmunk physics example I put together.
It uses the accelerometer and UIKit for drawing - just replace the crates with your own objects. (The accelerometer doesn't work in the simulator, you'll have to try it on a phone).
UPDATE: now you've added the image I realise you mean a bob on a string (I thought you meant a UILabel that falls around the screen, lol!). Here's another example that includes a tether between crates. If you use this plus the Chipmunk docs you should be able to figure out what to do.
You'll need to attach one end of the string to a static object, or one with infinite mass (not included in my example).
If you want a realistic string, you'll need to break it up into several short constraints instead of just one long one, but I suggest you start simple if you've not got much experience with physics libraries.
I have image named "platform.png" that represents one brick for platform of a IPhone game. I have a cartoon character that will jump on this platform.
A series of platform.png will form one complete platform. These series will be generated by swiping finger across Iphone screen. When character will jump on this platform it should go down like elastic and bounce back up. Can anyone tell me how to do this ?
Thanks in advance.
What yo want is Collision Detection. I don't think using Cocos2d will be a great idea to use in this case because you want to show elastic and bounce effects which should seem real. For this, what I suggest, is using Box2d which clearly help in showing the effects in a natural way. Here Collision Detection can be handled in a separate class known as ContactListener. You can study Box2d and ContactListener here. In ContactListener you can generate these effects and this class is very easy to handle. Two or three months back I used the same to create my game Pogo Jump and believe me I was very easy to work on Box2d.
Good luck..!!
heye ,
you have two options for this , either use box-2d/chipmunk or dont.
If you have prior experience with Physics then i would say box-2d/chipmunk would look more realistic.
i am building a game which is similar to the Plain Jane Flash Game for the iPad. I have decided to use cocos2d for the same, while exploring the cocos2d there are lots of option i am having. i am confuse in which elements/controls would be best for this type of game Please guide me or share any link/tutorial on cocos2d which have similar user interface.
I mean shall i use CCMenu/CCmenuItem or there is another control which is more suitable...
shall i use Sprite or simple image would be sufficent as i do not need to move anything in it.
Thanks
Although your question was not very clear, I assume your referring to the functionality of dragging and dropping different clothing items onto the game avatars. A custom CCSprite object would be much more appropriate for doing that.
However, there is not an easy answer for what you are asking. Creating a game like "Plane Jane" will involve many problems that I'm sure have not crossed your mind. I recommend you complete a few Cocos2d-iPhone tutorials before you go any further. Once you do that, you will have a much better understanding of the functionality you will need to create your game.
Here is a nice tutorial for starters:
http://www.cocos2d-iphone.org/archives/582
1- let's say there is a box on the screen and as soon as it gets hit by another box it suppose to move. How can i detect (getting hit) on my box object? Is it a good idea to use an nstimer which runs every 0.1 seconds and looking for the location of other objects around itself?
2- What is the best way to display simple 2d animations?
Install the Cocos2d templates and then instead of using the standard Cocos2d template use either the Chipmunk or Box2d template. Box2d has the benefit of C++ where Chipmunk is C based. Both still use Objective-C though for a lot of stuff. Heres where Cocos2d is. Note: All three templates have animation abilities.
When you drag an iphone GUI element like a list, it scrolls in a physics correct way, and also has a nice bounce effect at the end.
I would like to write a GUI element in my game, without using UIKit. I wonder where is the code implementing this, and if I can use it instead of trying to write something similar.
Any ideas?
I think that a physics engine would be overkill for just animating a gui element (unless you already have a physics engine in your game).
You could try using animations but I've no experience of doing this without UIKit but I suppose you would start here?
If you didn't want to use Core Animation, I would take a look at Robert Penner's easing equations - they're in actionscript but are pretty simple to port to C and would be a good start to get your own animation code started.
Hope this helps,
Sam
You can perhaps use animations to achieve this, you can define animation paths for bouncing or doing whatever it is you need and activate them when needed. I think the example project MoveMe can help you out
I can recommend the O'Reilly book "Physics for Game Developers" by David Bourg, which has great coverage of algorithms and code for all sorts of simulations. You probably want to start with motion affected by drag for the flick and gradual slowing, then look at a spring model to simulate the damping at the end.
box2d is an open source project that provides a great 2d physics engine.
this library is used by Intel clutter, which is a nice physics oriented UI library that is capable of running on mobile devices. that means that box2d is already optimized for mobile platforms like the iphone.