Search:

Type: Posts; User: Gravity Games

Search: Search took 0.09 seconds.

  1. Replies
    31
    Views
    2,991

    Re: Components?

    Nevermind, I saw a method in the suggested endings list in Eclipse called ".get(index)". Apparantly Arraylist.get(index) was exactly what I needed! Thanks for all the help you guys!
  2. Replies
    31
    Views
    2,991

    Re: Components?

    I'm already using toString, the problem is reading the string from the ArrayList. I'm thinking the toArray() method might be the answer, but it seems like it wastes resources.
  3. Replies
    31
    Views
    2,991

    Re: Components?

    I'm converting ints to strings to add to an array list and then trying to read the line of the arraylist to convert it back to an int. What method should I use to get the int/string?
  4. Replies
    31
    Views
    2,991

    Re: Components?

    ...and of course ANOTHER problem comes up. Now I can't get the game to read a certain line of an ArrayList...

    What am I doing wrong here?

    g.fillRect(Integer.parseInt(xarray[a]),...
  5. Replies
    31
    Views
    2,991

    Re: Components?

    I already have printlines showing each variable, and each one shows, but I think the problem is that the first integer is replaced a frame later. I don't want to use arrays since they're stuck at the...
  6. Replies
    31
    Views
    2,991

    Re: Components?

    I thought classes and objects were interchangable...well I guess that's the kind of thing a bad tutorial can do to you...well I'm making the object part of the JPanel class for simplicity, but I can...
  7. Replies
    31
    Views
    2,991

    Re: Components?

    How should I call the draw method then? Just use GroundTileATop.g.draw?
  8. Replies
    31
    Views
    2,991

    Re: Components?

    Yeah it gets into state 8, and I'm not using a timer because at one point it worked fine and then at another randomly threw an error. Also, I only want to draw the objects once, and I'll use a...
  9. Replies
    31
    Views
    2,991

    Re: Components?

    Well, here's the full JPanel Code:

    package scorpioengine.main;

    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    import java.util.*;

    import javax.swing.*;
  10. Replies
    31
    Views
    2,991

    Re: Components?

    EDIT: Duplicate post for some reason, I guess I must have double clicked submit or something.
  11. Replies
    31
    Views
    2,991

    Re: Components?

    Wow, I can't believe I made such a dumb mistake...now it doesn't crash, but I can't get the object to show up properly. What now?
  12. Replies
    31
    Views
    2,991

    Re: Components?

    Alright, here's the code of GroundTileATop:

    package scorpioengine.main;

    import java.awt.*;

    public class GroundTileATop extends Tile{
    int width = 32;
    int height = 32;
    public...
  13. Replies
    31
    Views
    2,991

    Re: Components?

    No, GroundTileATop IS the object. Should I try returning the object instead?
  14. Replies
    31
    Views
    2,991

    Re: Components?

    The line that throws an error:


    add(GroundTileATop(spx,spy));

    Error Eclipse gives in the console:
  15. Replies
    31
    Views
    2,991

    Re: Components?

    Even when I extend component, the object won't get spawned by the JPanel. What should I do?
  16. Replies
    31
    Views
    2,991

    Components?

    Hi, Gravity games here, and I was trying to add an object to my JPanel. However, for some reason it says I need to specify a component. Whats a component and how do I use it to add my object?
    ...
Results 1 to 16 of 16