Help coderanch get a
new server
by contributing to the fundraiser

# Tony Craven

Greenhorn
since Aug 14, 2007
For More
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by Tony Craven

Actually, I figured out how to do what I wanted in the end.

Briefly, starting at 90 degress.

And each sensor after that would be (45 / 7 * i), where i was the sensor number.
16 years ago
Sorry for the long delay in replying, thanks a million for your suggestions. I got it working in the end by splitting the paddle up into 5 sections and if the ball hit one of the sections, I'd set it's return vector from a predefined list.
16 years ago
Hi,

I'm trying to draw a visual representation of an array of sensors for a science project demonstration. The 7 sensors are at the front of a little bot.

I'm having trouble finding the right way to do it in java, I'm using Line2D.Double to represent each sensor but when it comes to spreading them out equally over the pi/4 range, I'm stumped.

I guess this is more a maths problem, than a java problem, but I'd really appreciate any help!

Thank you,

Tony
16 years ago

...When the ball comes calculate the angle at which it came , then reflect it back at that angle to the opposite side...

I was starting to come to this conclusion myself, it sounds like Snell's Law in Physics. I'll give it a go!

Tony
16 years ago
Hi,

I wasn't sure whether to post in Micro Edition forum or not as this relates to my attempts to make a pong game for my phone. I'm trying to work my way through the simple games...if I can master Pong, Tetris will be next!

The problem I'm having is that I'm unsure as to how to get the ball to move at angles from a paddle once it strikes one.

Currently how I'm trying to do it is:

I've tried to get the ball to move by changing its x direction when it collides with a paddle (so dx = 1, then dx = -dx) but the ball does not move very realistically as it seems to always head back in the same direction after each collision.

I was thinking that I could check to see what section of the paddle the ball collided with and use that to pick which value to set dx as -1 / +1.

I'd be really grateful of any tips, I don't really want to go looking at other people's source code on the net.

Thanks

Tony
16 years ago
Thanks for your reply Pete, I'll spend some time looking into JPanels this morning
16 years ago
Hi,

I'm trying to build a simulation environment for an artificial life project and I'd prefer not to use a JApplet.

My previous experience with Applets (I wrote a beat 'em up game for an under graduate project) was from a couple of years ago and I've been doing a lot of C++ programming since, so I have forgotten a lot.

I'd like to be able to display my simulation (I guess it would be like running a game in the Frame) - a moving robot around a 2D maze - and also include buttons for the user to pause the simulation as well as bring up other Frames with statistical information.

I'd also like to be able to network more than one simulation, I know there is a security issue with trying to network Applets in java though.

I'd also prefer to be able to run the simulation from a jar file.

While I don't have a lot of time to code this project I'd prefer if someone could send me links for tutorials than actually tell me explicitly how to go about it. I've been going through the tutorials on the Sun site but I have to say that I find them a bit hard to follow.

Thanks very much for your time,

Anthony
16 years ago