View previous topic :: View next topic |
Author |
Message |
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Sat Apr 25, 2009 8:23 pm Post subject: Block'd game question |
|
|
I created a game called Block'd. I haven't finished all the levels but I do have one level for you guys to play.
I mostly have a question on the behavior of the attractor that i put in place which is one of my reasons why im posting this now. The attractor only attracts the objects not the player. Im just wondering if it is working properly or if I screwed something up. I noticed that some shapes act very oddly which I can't understand why.
Here is the file.
http://www.box.net/shared/lcf03o6i5t
I couldn't find much information on these forces. I didn't see anything about this on box2d wiki. |
|
Back to top |
|
|
zzzzrrr
Joined: 17 Feb 2007 Posts: 139 Location: Washington, DC
|
Posted: Tue Apr 28, 2009 11:37 am Post subject: Re: Block'd game question |
|
|
mike wrote: | I created a game called Block'd. I haven't finished all the levels but I do have one level for you guys to play. |
Great job; it's a good start!
You should be able to attach the attractor to any body. In what manner are you using it? It's difficult for me to notice in the demo.
It may help to include your code with the demo, or post code samples, if you're looking for specific help. |
|
Back to top |
|
|
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Tue Apr 28, 2009 5:53 pm Post subject: |
|
|
Thanks zzzzrrr.
Heres my code of the attractor
Code: | //Attractor
bzAttractor attract;
for (int i = 0; i < lvl.makeobjects; i++)
{
attract = new bzAttractor(lvl.bodyObject[i], bzVec2(12.5,9.375), 5,3, 10);
bWorld.addForce(attract);
} |
Right now I am adding the force while it is static, maybe if I add the force as soon as it is no longer static that might help me out. Do you think that would make a difference? |
|
Back to top |
|
|
zzzzrrr
Joined: 17 Feb 2007 Posts: 139 Location: Washington, DC
|
Posted: Tue Apr 28, 2009 7:52 pm Post subject: |
|
|
mike wrote: | Right now I am adding the force while it is static, maybe if I add the force as soon as it is no longer static that might help me out. Do you think that would make a difference? |
Try setting:
world.allowSleep = false; |
|
Back to top |
|
|
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Thu Apr 30, 2009 5:38 pm Post subject: |
|
|
Still kind of tough to tell but i think they are not acting as violent anymore.
Thanks.
I'll post the code and the final version in a few weeks. I entered the game in a competition that is near me. Wish me luck . |
|
Back to top |
|
|
zzzzrrr
Joined: 17 Feb 2007 Posts: 139 Location: Washington, DC
|
Posted: Fri May 01, 2009 7:40 pm Post subject: |
|
|
mike wrote: | I'll post the code and the final version in a few weeks. I entered the game in a competition that is near me. Wish me luck . |
Good luck! |
|
Back to top |
|
|
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Sat May 23, 2009 9:27 pm Post subject: |
|
|
I finished in 3rd place. Here is the completed project along with the source code. The exe file is located in the debug folder which is inside the bin folder http://dsource.org/projects/blockd
Again zzzzrrr thanks for all your help. |
|
Back to top |
|
|
|