[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Help with a snooker game.

Help with a snooker game.

Official forum for the .

Help with a snooker game.

Postby kennya » Fri Mar 27, 2009 4:47 am

Hi all,

I am a first year university student and was given an assignment to create a simple marbles game using Chipmunk. I completed the assignment but in doing so I was spurred on to try and create a game of snooker. Probably trying to run before I have learned to walk. I have created the basics of the game I have the Table and all the balls and I can fire the cue ball in different directions by manually typing in the x, y coordinates and everything works fine, the balls strike each other correctly there is the correct amount of velocity, collision and bounce from the walls and balls etc.. My problem now is how to move on to the next stage. I have now added a cue as a body and my intent is to have the cue appear on the screen at the start and to be able to rotate the cue around the cue ball by using the left and right keys. Once I have selected the correct position the coordinates of the cue should be fed to the cue ball and when I pull back and release the cue using the enter key the cue should head in that direction, strike the cue ball and then heading in the intended direction.

So the problems I am having;

I need to be able to write some code that rotates the cue around the cue ball, feeding in the coordinates of the cue to the cue ball. At the moment when I use any key on the cue it is acting as if it were a ball and firing off in a fixed direction.

I need to be able to just have the cue pull back strike the cue ball and stop after it has struck the cueball, passing all of its velocity and direction values to the cue ball and then disappear off the screen until the cue ball has come to a rest.

When the cue ball has stopped the cue will reappear and the process can be repeated.

This is just a game I would like to get up and running, after I have completed this part of the process there will still be an awful lot to write i.e 2 players, rules of the game, point scoring etc.. but I am enjoying the challenge of writing the game.

Any input, help or feedback would be appreciated

And Finally may I take this opportunity in thanking slembcke for such a marvelous physics engine, you are taking games programming to a new level. Thankyou
kennya
 
Posts: 1
Joined: Fri Mar 27, 2009 4:05 am

Re: Help with a snooker game.

Postby maximile » Fri Mar 27, 2009 8:22 am

You're making things much much more difficult for yourself by having the cue as a body. I'd just handle the cue with your own code, and when it's time to strike the ball just apply an impulse to it based on the speed and angle of the cue.
maximile
 
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK

Re: Help with a snooker game.

Postby slembcke » Fri Mar 27, 2009 9:55 am

Yeah, I'd agree with that. You probably don't want the cue to be a real physics object. It will be way easier to fake the cue movement and use an impulse or just set the ball velocity to go in the direction it was hit.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 4 guests

cron