Search:

Type: Posts; User: Gravity Games

Search: Search took 0.07 seconds.

  1. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Yep, I'm having trouble again. I can only get the game to draw the last object of the file.
  2. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Thanks elamre! Now I have the game reading from the file! (Sorry for the late reply, my internet was down for a couple of days...) If I have any trouble getting the game to spawn the appropriate...
  3. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Alright, I think its best if we go at this completely fresh. Alright, so I've changed my code up a bit so the file is actually read though the main JPanel. Here is the ENTIRE code for it:

    ...
  4. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Well, changing hasNextLine and nextLine to hasNextInt and nextInt respectively doesn't work and still gives me an error. Removing the lines that set the string and array and setting the ints in the...
  5. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    The problem must be with the split into the array. I tried using " " as the split like was said, but its not working. The arg for parse int is the array to which the string should be splitting.
  6. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Changing "s1" to a space fixes the out of bounds error, but when I try to run now, I get these errors
  7. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    When I try to run it, these are the errors that come up in eclipse:



    Since the other errors come up at the start of the "read" method, and when the Main object is added to the JFrame, it can't...
  8. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Sorry for the slight bump, but since the last post doesn't update for edits, I wanted to make sure people know that I've updated my post, hopefully reposting my question will make this post slightly...
  9. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Okay, I'll modify my small array testing program and see if what you said works. Wish me luck!

    Edit: Having a little trouble, am I reading the different parts of the array properly? (str1 is the...
  10. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Currently the file has 3 integers per line in it like I was told, with spaces inbetween each. The first one is the item ID, when its a certain number, I want a certain object spawned (The main ground...
  11. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    So I should change my code to something like this?:

    public void File(){

    try{
    l = new Scanner(new File("C://CWWLEVELS//world1stage1.txt"));
    while(l.hasNext()){
    for(int i=0; i <...
  12. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    The reason I say I would have to set up a maximum X and Y is because of my read file method:

    public void File(){

    try{
    l = new Scanner(new File("C://CWWLEVELS//world1stage1.txt"));...
  13. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Alright, so what is the best way to get my scanner to read the file and write the variables to integers? Unless I'm missing something, I'd have to have a hardcoded maximum value of the X and Y...
  14. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    But the problem I see with this is how would I be able to add more tiles than just the same ground tile, like say a water tile or the player?
  15. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Well, I'll need more objects, this is just the one I'm coding first. So how would I add the objects like you said? I don't understand the way you put it.
  16. Replies
    41
    Views
    2,937

    Re: Help with an object based level format

    Well, I'm trying to write a list of objects in an external file to an arraylist, then place each object on the JPanel in order. I've got a tutorial I'm following for the actual placing that should...
  17. Replies
    41
    Views
    2,937

    [SOLVED] Help with an object based level format

    So I had to scrap my old tile based level format for an object based one so I could use arraylists. The first thing I need to figure out is how to execute Java code written in a text file. The reason...
Results 1 to 17 of 17