Edited by scheppy
this sounds good. I accually had to work work today instead of code. So here I am. I will try to implement this method first. Sounds like a simple Easy to understand way of doing it from the post:). We will see!
ps!. This idea sounds super good. why dident I think of somthing so simple
Edited by scheppy
To the OP...
What is the spec for this? Where is this leading? For instance, do you now need to deal with or will you eventually need to deal with any of the following?
It's sort of hard to give advice not knowing these details since the advice will be considerably different based on the answers. In my opinion the toughest part of programming is not the coding aspect but trying to decide what is important and probable and "good enough". I would also give different advice based on experience level and physics/math ability and outlook. I'm a math/physics/engineer type guy so I like dealing with that stuff and algorithms. Other people, not so much, and that's going to reflect in the code. I could list all sorts of other potential issues that might change the way I would approach things. I get the idea that this is for a course, that you are fairly new at Java, and would rather not do a lot of math if you can help it. That's just my impression.
Anyway, good luck. I don't have any more time to help you on this, but hopefully I was able to add something useful. You are in good hands with James. I just wrote this post for general advice on getting help. Sometimes it's good to ask a succinct question on a particular topic and sometimes it's best to stick as much details as possible out there up front. And sometimes it's hard to tell what a topic will turn into, which is what makes life interesting.
This is not for school, or for a course. this is for a pseronsal project or mine just so i kinda know some things before i go to school.
So right now I have a screen full of circles that are all bouncing around, and you can place rectangle and squares where you wish. The circles will than also bounce off of these.
I also want to make edges of the screen not straight. for example on the bottom of the screen a few curves. the balls would then have to bouce off these curves also.
I have the circles bouncing around on screen, ability to add circles of various sizes colors and mass. ability to add rectangles/sqaures.
Also already have the ability to control the retangles/squares.
Also going to put in the ability to rotate these rectange and squares.
Thanks for everything.
Edited by Jonathan_28
Hi Jonathan - it sounds like things are going really well. How are you doing for structuring all this code?
ps Why the new user ID?
I had to update my mac, and I cleared all my saved passwords and everything and couldent remember my password but I have it now:).
Im not entirly sure about the structure.
Right now I have my main class, which includes Jframe and keylistener and mouselistener
than I have the model class... this class contains all the updating information... and -collisions
dimensions class, includs all dimensions scaled for the users screen size.
I have a ball class
a player class
a rectangle/sqaure class
renderer class, includes all the painting for everything...
and a mousedata class for if the user is dragging objects around the screen.
Right now im working on the rectangle collision, accually just starting to work on it again, and once i have that working i will mark this thread as solved:).
ps Im not sure where this is accually leading, i just want to make sure I have everything down pat when it comes to collision and design of classes and such. Ive make many swing application already... but most of them where all in 1 class.., and this is also the first time dealing with painting and such. In swing everything was automatic. This is much more interesting.
Edited by scheppy
Im not sure where this is accually leading
Doen't matter. Sometimes it's just fun and educational to set off in some direction and see where it leads you and what you learn along the way.
Have you thought about all the things that are common to balls and rectangles (the way they move, how they can be controlled with the keyboard and mouse, etc.) - do they look like subclasses of some abstract superclass that models a thing that moves about, can be controlled, collides with other such things etc? Just a thought.
not really no, To be honest Im not sure I understand the question. Im going to have to do some reading on those terms :/.
I guess I only have one package, I dont have any superclasses, or subclasses, but ill look it up.
Also I think Daniweb should put the newest pages first, or atleast automatically go to second page last comment if the user is the poster.
Edited by scheppy
Well I have a little time to help a little more after all. Or to be more accurate, I feel like taking a break from my real work but want to pretend I'm still working so I'll do something computer-related rather than watch Friends reruns. :)
Superclasses and subclasses are a must here if you need to handle different shape types differently (which you do) but don't want to have to type the same thing over and over again when things are the same.
Take a square versus a rectangle. A square is a TYPE of rectangle so you could have a Rectangle class and then have a Square class extend that Rectangle class (the key word here is "extends". Look for that word in your classes to quickly determine which class is the superclass and which class is the subclass. Certain things are going to be handled no differently for a Square as opposed to a Rectangle. An example would likely be movement. It'll be exactly the same for both, so put the Move function in Rectangle, the superclass. Ditto Circle versus Ellipse. Make a Circle a subclass of Ellipse if you decide to have both.
One the other hand, there are a few things that are easier to calculate with Squares versus Rectangles, and which are certainly easier with Circles versus Ellipses, so sometimes you have a specialized function for the Square of the Circle (collison detection and rotation are two things that stand out as easier for these subclasses as opposed to their superclasses, rotation being extremely easy for a Circle obviously because it has no effect (unless you want to get very technical).
You put things that are the same in the superclasses and you put what is different in the subclasses. It can get really tedious having to write/change the exact same Move code for rhombuses, parrallellograms, rectangles, squares, quadrilaters, polygons, triangles, pentagons, etcetera, etcetera.
Edited by AssertNull
Agree with you on the "Navigating to the end" comment. There's a link for each page, but it's at the BOTTOM of the page not the top, so to get to the last page or to find out if there's more than one page, you have to scroll past a page worth of posts.
Ok guys, I have it all pretty much figured out and working smoothly for now:)
i think this is usefull, a lot of the users have problems with .Net Framework installation,
Error code: HRESULT 0xc8000222
Do these to solve:
a: Click Start > ...
There are a number of very old threads on CUDA so I'm starting a new one rather than resurrecting an old one.
Does anyone here have any experience setting up ...