Hey all,
I take no credit for this at all but i was just looking around on google code and i found a pretty nice box2d demo app. Heres the link:
http://code.google.com/p/crayonballdemo/
-Lars
Found a good Box2D demo app.
(29 posts) (13 voices)-
Posted 2 years ago #
-
Very cool. thanks! :)
Posted 2 years ago # -
just to clarify, this sample code has box2d and cocos2d running and it looks pretty good. If whoever did it reads this forum, nice work!
Posted 2 years ago # -
Wow that's awesome.
Posted 2 years ago # -
Whoever submitted that - thank you very much.
@all: Has any of you managed to build that project for your device? It runs very well on the simulator but when I try to build it for the iphone I get an error: "finite was not declared in this scope"...
Thanks,
MarcoPosted 2 years ago # -
Same here, didnt sorted it out so far.
Posted 2 years ago # -
To fix that, go to the box2d build properties and add '-DTARGET_OS_IPHONE' as a C flag.
Posted 2 years ago # -
Thanks! How did you find that out?
For all who are still searching: Doubleclick the "Box2D" Target, go to the "Build" Tab. It´s under GCC 4.2 Language: "Other C Flags" (I guess that´s what Joao was referring to. For me at least it works now...)
Marco
Posted 2 years ago # -
Yeah, that's the one :)
Well, I had the same issue when starting with box2d a few months ago.. just followed the warnings and they go to this line:
#ifdef TARGET_OS_IPHONE
return isfinite(x);
#else
return finite(x) != 0;
#endifin b2Math.h.
Posted 2 years ago # -
okay, thanks! :o)
I´ve seen those warnings, too, but I still didn´t know how to solve this problem.
Marco
Posted 2 years ago # -
Very cool sample app! Thanks to whoever built & shared it!
-Bryan
Posted 2 years ago # -
thats sweet! Thanks for posting, & thanks to the original (Japanese?) coder who created the project!
I've only just started looking into box2d, and this may have been posted before, but a site with some nice tutorials on box2d is:
http://iphonedev.netPosted 2 years ago # -
looks nice
Posted 2 years ago # -
I removed the audio code in ShowLayer init & dealloc methods, and it loads much quicker, I presume because it was an ogg file.
Posted 2 years ago # -
Thanks for your comment.I am the author of this demo.This demo still has many bugs, i'll fix bugs when i have time.
BTW I'm chinese.Posted 2 years ago # -
hi joao.you mean the flame of ball when it hits the booster?i just used the paleysystem of cocos.
before the box2d version,i made a chipmunk one.but it really hard to simulate many joints so i decided to used box2dPosted 2 years ago # -
Hi wenjun, thanks for sharing this app. Do you plan to make a game with it ?
[edit] the -DTARGET_OS_IPHONE didn't solve my problem, I guess I don't add it in the right place.
Posted 2 years ago # -
this demo's idea is from a mac game named crayonball.so i just borrow its idea to make a practise demo.
Posted 2 years ago # -
Hi Wenjun,
Your code is very good and it covers all the thing like moving ball, polygon rotation, etc. I am referring your code for my game project. But i have one question that how you are rotating polygon body. Tipper is moving is also very good. I think that ShowLayer class is handling all the things right?. I have more interest in flipper and its rotation. I tried to understand where rotation of flipper is happening but i didn't get anything. Actually i want to rotate polygon like its rotate in your code. I got sprite rotation but how can i rotate corresponding body at specif angle.
Please give some advise.
Thanks.
Posted 2 years ago # -
Hi iphonemobdev:
The rotation of flipper is done by applying a revolute joint.The revolute joint is used to make the flipper can only rotate around a specified anchor point,the max/min rotation angle and the maxMotorTorque as a resistance to make sure the flipper can go back to its original angle after the ball hit it.Posted 2 years ago # -
Hi Wenjun,
Thanks for the reply.
Another more question that when it will rotate?. It should rotate when collision will occur between ball and flipper. In which method it will rotate or automatically it rotate when collision occurs. Of suppose i want to rotate at up side when user touch the screen, so what method will rotate this joint.
Thanks.
Posted 2 years ago # -
Very good demo!
Posted 2 years ago # -
This looks great. Perhaps a bit of a noob question, but having plugged in the C flag, and updated info.plist with my own details, the only error I am getting trying to write to the device is:
codesign error: code signing identity 'iphone developer' does not match any code-signing certificate in your keychain
Regards
i
Posted 2 years ago # -
@ indy2005; have you set the provisioning profile to one of your own? Sounds like that might be the problem. If it runs fine in the simulator I'm sure that's your problem.
Posted 2 years ago # -
Hi,
Isn't my provisioning profile set via the XCode organiser rather than the project itself is? I have changed the bundle identifier in info.plist, not sure what else to do. My profile is installed via the organiser correctly and I can install other apps to the device OK.
Thanks again.
i
Posted 2 years ago # -
"I have changed the bundle identifier in info.plist" that should be it if you also have the provision in your organizer. Double check you didnt make a mistake with the identifier. The standard advice is: power your device completely off (hold both buttons down for five seconds) - quit xcode - restart your device - restart xcode. Good luck!
Posted 2 years ago # -
What I was suggesting is something else, different to the bundle identifier.
The provisioning profile is needed to tell XCode, "yes, this code is allowed to be deployed to this real device because I have a license to do so". Double click the target and you'll see your build configurations, you'll have to make sure you've selected the correct provisioning profile for the build you are doing.
If this is still unclear I recommend visiting the official Apple developer forums where you can find more (very useful) information explaining how to use Provisioning Profiles and what they're for. You can also find out what Bundle Identifiers are for.
Posted 2 years ago # -
found it...thx
Posted 2 years ago #
Reply
You must log in to post.