Home » Newcomers » Newcomers » Making something go towards a certain point and then detect collision ( Making something go towards a certain point and then detect collision )
|Re: Making something go towards a certain point and then detect collision [message #1799102 is a reply to message #1798959]
||Thu, 29 November 2018 17:37
| Patrick Moran
Registered: March 2018
I think you will have to learn how to draw lines, extend lines, etc. |
Then perhaps you can do something like this. Check for whether line A(x,y) and line B(w,z) have a situation where x,y == wz, and if so, go back a step, terminate line A and start line Aa going off on some other direction. Make it simple to start with, e.g., just rotate 45° and go along that new line, always checking each time you do a new x = x + 1, y = y +1.
Hoping for some beginner using Eclipse to make a program for you would probably result in that person's making the kind of thing that works for them but won't work for you in the long run because they have only fulfilled the stated part of your problem, and they haven't seen that the next step in your mind will make their approach a sort of dead end.
If you can use Eclipse, then make a project called, e.g., Bevis_1. Then make a class that will produce a GUI window to work on. Select "src" under Bevis_1,, then File/New/Other/Window Builder/Swing Designer/Application Window. Call it something like Drawer. Eclipse will open the "Source" view of Drawer.java for you. Switch to the Design tab, and you will see a screen with a window that you can start working with.
I would start by making two JTextField "text boxes," one called Starting point, and another called Ending point, and a button called "Draw line." Then try to incorporate the most basic thing you could do given the stuff linked to above. What you want is to fill in two numbers, hit the button, and have the line drawn.
When you get that going, then make a new button called "Draw to starting point +1," which is a little different from the first button because now you don't explicitly go from x to x', you just go from x to x + 1.
When I am setting things up for myself, that is about as far ahead as I let myself think, since once I get into implementing what I think I want I will probably see some complication that I hadn't imagined, prefigured in my mind or whatever you want to call that lack of perfect foresight. So. I will stop at this point.k
Current Time: Sat Feb 22 17:10:13 GMT 2020
Powered by FUDForum
. Page generated in 0.06068 seconds