Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Hello, I have a program which creates multiple balls and bounces them off when they collide. This works fine. import java.awt.Rectangle; public class Ball{ private int x = 0; private int y = 0; private int radius; private int panelwidth = 500; private int panelheight = 500… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa Some minor syntax fixes. Some things to consider are the collision and distance of drawing the next ball. A ball inside a ball's radius will cause numerous collisions. Even the starting ball locations can be already causing collisions. I added a collision counter display. Increased the maximum balls to make to 50. The timer delay can also impact … Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa I cleaned up the code some more. Removed some things that were not being used. I ran into a couple problems which caused the freeze you mentioned. It was memory heap space and array allocating. E.g., if x or y becomes negative, and also infinite recursion. I added a x/y coordinate display for a ball, and tinkered with the placement of the … Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Thank you so much for your reply and additions! It is certainly working as I wanted. I will read through the code you have added and ask you any questions I might have. I hope you don't mind. Regards Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by Dani I’ll mark this question solved :) Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by Dani … oh, sorry, missed the bit about you still needing clarifications. Feel feee to ask :) I’ll now unmark this topic as solved. /facepalm Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Hello, Thank you again so much! All your additions are clear, but it seems like whenever two balls collide, more than one ball is added to the arraylist and painted. Any way to have just one ball added to the panel for every collision? Have some kind of a toggle flag in paintcomponent? Regards Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa Yes, this is true. Overlapping ball spawns can do that causing a chain reaction. Something like that could be done. How you handle the spawning of the new ball is what I played with a bit before. You will see better collision detection changing to: g.fillOval(ball.getX(), ball.getY(), 1 * ball.getRadius(), 1 * ball.getRadius()); Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Got it. Thank you so much! Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by vortex_1 In my opinion, implementing a feature in a bouncing balls simulation where a new ball is created when two balls collide can add an interesting and dynamic element to the simulation. This feature can introduce a sense of complexity and unpredictability, making the simulation more engaging and challenging for users. It could also provide an … Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Great reply, vortex! Agree with all your points. Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by aishamushtaq Hi, Its helpful for me. I got my answer. Re: Is Coding About Authoring or Achieving a Specification? Programming by Reverend Jim As an example, here is some code we got from a vendor. It is rock-solid. It does what it is supposed to but it is virtually unmaintainable. I can't begin to imagine how it was ever debugged. SUBROUTINE READALL(UNIT,BUFF,*,*,IFIRST) C*TTL READALL READ FROM ANYTHING C THIS SUBROUTINE IS USED FOR READING COMPRESSED OR … Re: How can I upload a tar.bz2 file to openstack swift object storage container Programming Software Development by Salem First, let's prepare two tar files using different compression schemes for demo purposes. $ cat foo_1.txt This is file 1 $ cat foo_2.txt This is file 2 This is file two This is file too # Three tar files, two compressed and one uncompressed for reference $ tar -j -c -f foo.tar.bz2 foo_1.txt foo_2.txt… Need Help In C++ Programming Software Development by brale J don't know how to detect mouse click and how to get cordinates of mouse pointer in the moment of click? J need functions that detect mouse click on console. Need Help With Infix_value Function Programming Software Development by brale J need function that calculate formula in infix notation. For exempele function that takes string as argument and return an float as value of that formula. J make function that calculate postfix formula but it is not help me to solve problem. My name is besnik Hardware and Software Microsoft Windows by Besnik.Mersim j need windows 8 j em fro Macedonian HarryPotter.com Hardware and Software Networking by happygeek J.K.Rowling has now officially announced that the latest, and last, in the Harry Potter series of books will be called ‘Harry Potter and the Deathly Hallows’ putting an end to the frenzy of speculation on the subject over the last few months. While it has been genuine fans interested in all things associated with their hero who have been … Autogenerating photo gallery Digital Media UI / UX Design by modemjunkie J ust want to be able to dump photos into a directory on my server and be able to generate a simple of thumbnails and a way of looking at them and the photos. I tried Autogenerating Photo Gallery (AGG). I uploaded the package as it came with its sample photos to [url]http://lgrossman.com/pics/AGG/[/url] and it works fine. The sample thumbs … JDesktop:JInternalFrame out of scope Programming Software Development by ceyezumma j ///////////////////////////////////////// Hello; I Have a JDesktopPane that opens with a x frame (JInternalFrame)wit a JMenuBar and 11 JTabbedPanels .produced by x.class.I click the menuItem to produce z.frame using x.class a new JInternalFrame with 4 tabbedPanels on it again produced by x.class. Now I click on x.frame and try to again use… some doubt about syntex Programming Software Development by newbie1234 j=h(a||b) h= pesudo random function, a and b id 128 bit key. 1. What i understand is a or b and give this as a input to h. That will be output. Is it like that? 2. and i want to know that how can i store value 128 bit and perform OR operation? i s there any help Re: GTK Hangs & An Index Error Programming Software Development by pymatio "j" is to big for "homea", "homea" is the right size. Re: insertion sort Programming Software Development by TrustyTony > j>0 && value<a[j-1] That statement is part of first for executed in this condition and repeating `j--` at end of each loop. `a[j] = value` is only excecuted after the loop finishes. Re: Problem with precedence in C Programming Software Development by iamthwee j++ means j == j +1 but ++j means add one before u do the next thing i thinks. God bless. Re: loop while Programming Software Development by ddanbe J and k have also have to be declared. WriteLine also has to contain a placeholder {0} for the variable i. You have to put in somethin like a ReadKey method to let the console window stay on the screen. Here is the code: [CODE=csharp]static void Main(string[] args) { int i = 1; int j; int k;… Re: Creating teams from a text file Programming Software Development by Ezzaral j+6 is not what I wrote above. That is quite different than length-1. Re: error c2780 & c2782 Programming Software Development by Moschops `j = min(A,i);` At this point, the compiler is not aware of any function named min that takes an int-pointer and an int. cout <<"A.) Insert NEW Student Record."<<endl <<"B.) print all Student Record."<<endl; <<"C.) Sorting."<<endl; Take a good look at the end of that … Re: prime problem Programming Software Development by Lerner j is incremented by one each time through the loop. On line 11 is the instruction to break out of the loop if j is over 12. So it seems like the code is doing what it has been written to do. Re: Cant get first value from dropdownbox using jQuery Programming Web Development by Taywin >$j("#mydiv").val(1); Maybe it should be `$j("#mydiv").val('1');`? Re: More AJAX BS....Loading image after populating combo... Programming Web Development by pritaeas $j.ajax({ url: 'mysqlcall.php', async: false, data: { parameter1: varpas }, dataType: 'json' }) .done(function () { alert('done'); }) .fail(function () { alert('fail'); }) .always(function () { alert('always'); })