Hey guys,
I am a fairly new programmer and I am having trouble trying to figure out an algorithm or expression that will make my object move in a random motion vertically, with in certain bounds. Will show my code upon request.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hey guys,
I am a fairly new programmer and I am having trouble trying to figure out an algorithm or expression that will make my object move in a random motion vertically, with in certain bounds. Will show my code upon request.
Thread moved from Members Introductions.
This is a vague question, as the definition of many of the terms you posted can be interpreted in different ways. That being said, see the Random class which has methods that allow one to get a random number - be it an int constrained within a particular bound or a floating point value that can be used to create a value constrained within a certain bound. If this is not what you're looking for, then I recommend elaborating on exactly what you need.
Yes, please show your code that creates the object and any you may have that animates it. With that, we should be able to give you some ideas how to program it to move "randomly," though as copeg said, it would be helpful to know what that means to you. An object simply jumping from the bottom to the top of the visible area and anywhere in between is not pleasing animation, but maybe that's what you're going for.