Tim Driven Development | Test until the fear goes away
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:Well, for openers, you are using K&R indentation style, not Allman style. There may be other things...
![]()
"Il y a peu de choses qui me soient impossibles..."
All things are lawful, but not all things are profitable.
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Fred Kleinschmidt wrote:2. Since your GamePanel instance covers the JFrame, all of the key events go to the GamePanel, not to the JFrame.
"Il y a peu de choses qui me soient impossibles..."
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
"Il y a peu de choses qui me soient impossibles..."
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Fred Kleinschmidt wrote:In my example, if you hold down the "a" or "d" keys, the oval will continually move, since holding a key down will continue to send keyPressed events.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Les Morgan wrote:
you will release the key and you will still get a movement until the key buffer is empty and that can be a considerable distance at times.
Fred Kleinschmidt wrote:
Les Morgan wrote:
you will release the key and you will still get a movement until the key buffer is empty and that can be a considerable distance at times.
that can be solved by implementing keyReleased and adding a flag that says to honor/ignore key events, (But care has to be taken to allow future key-presses)
No - I take that back; the key release event will just be queued after all of the other key presses, so won't be processed until all of the presses have been handled.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Alaric Mustoe wrote:So the oval is appearing but not moving I have taken into account that maybe it is moving a slow amount but that is not the case. Rather it isn't moving at all. Can anyone explain why this is?
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:
Alaric Mustoe wrote:So the oval is appearing but not moving I have taken into account that maybe it is moving a slow amount but that is not the case. Rather it isn't moving at all. Can anyone explain why this is?
Post your code as it now is, Alaric, so we can see what you've changed.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Les Morgan wrote:Because he never starts the timer to activate the actionPrefored method of the ActionListener which then appropriately increments the position variables decoded from the KeyListener input stored in "key".
"Il y a peu de choses qui me soient impossibles..."
Alaric Mustoe wrote:Les Morgan does have a point. I would like to have it shoot and do collision detection. But if I define a bullet which i have. Would it do better to use one and loop it or to have multiple and shoot all then refresh? Along with I need help with collision detection I know that you use intersecting point checks. But don't know how to utilize them.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Alaric Mustoe wrote:Les Morgan does have a point. I would like to have it shoot and do collision detection. But if I define a bullet which i have. Would it do better to use one and loop it or to have multiple and shoot all then refresh? Along with I need help with collision detection I know that you use intersecting point checks. But don't know how to utilize them.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Alaric Mustoe wrote:Les Morgan does have a point. I would like to have it shoot and do collision detection. But if I define a bullet which i have. Would it do better to use one and loop it or to have multiple and shoot all then refresh? Along with I need help with collision detection I know that you use intersecting point checks. But don't know how to utilize them.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Alaric Mustoe wrote:Les Morgan does have a point. I would like to have it shoot and do collision detection. But if I define a bullet which i have. Would it do better to use one and loop it or to have multiple and shoot all then refresh? Along with I need help with collision detection I know that you use intersecting point checks. But don't know how to utilize them.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |