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!
Type: Posts; User: Gravity Games
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!
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.
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?
...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]),...
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...
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...
How should I call the draw method then? Just use GroundTileATop.g.draw?
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...
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.*;
EDIT: Duplicate post for some reason, I guess I must have double clicked submit or something.
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?
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...
No, GroundTileATop IS the object. Should I try returning the object instead?
The line that throws an error:
add(GroundTileATop(spx,spy));
Error Eclipse gives in the console:
Even when I extend component, the object won't get spawned by the JPanel. What should I do?
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?
...