Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Hope you learned a bit about using println for debugging.
    I overlooked the static at first or this might have been a bit shorter.
  2. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Did you notice that ALL the variables in the Enemy class are static?
  3. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    When did you last look at the code?
    Look at the code in post#1
  4. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    What do you see when you look at the print out? It looks like there is only one instance of the class being put into all the slots.
    Do you know what it means when a variable is defined as static?
  5. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Little bits of code aren't useful to anyone for finding the problem in your code. As I've said many times before: You need to print the whole array after ANY updates to it. After every update to...
  6. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Why does the print out of the whole array show null in elements 4,5,6 ?
    Those slots had values when you printed them individually, but show null in post#13 when the contents of the whole array is...
  7. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    If you want to find and fix the problem, you need to print out enough to show you where the problem is.

    Did you see this in my last post? Can you explain how the code printed elements 4-6 when...
  8. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    You need to print the whole array after ALL updates to it. If you ever get good data into the array, there should be some place in the programs execution where the contents of the array is changed...
  9. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    What is the value of that index? What is the contents of the array at that index as shown by the printout?

    To make the printout of the array more readable add a toString() method to the Enemy...
  10. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    See post#4

    If the code that is changing elements in the array has a problem, then you need to print out the contents of the array every time a change is made to catch where the problem is.

    Does...
  11. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Add some more printlns to show all updates to the array
    also print out the contents of the whole of the array occasionally.


    A bug in the logic. Add more printlns to show the array's contents...
  12. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Print out the index and the contents at that index and the whole array occasionally.
    Be sure to have unique id Strings in the print out so you know which println() has printed what line:

    ...
  13. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    To debug this problem you'll probably need to show how all the variables are used and changed so you can catch where in the logic the program is going wrong.
    Try debugging the code by adding lots of...
  14. Replies
    27
    Views
    3,516

    Re: Need help with arrays

    Can you post the program's output and add some comments that show what the problem is.


    What does the ^ notation mean?
Results 1 to 14 of 14