I have recently begun coding a 3d computer game as part of my IB MYP personal project, Although I know a sufficient amount of Java I am having troubles getting my classes to work together. What I'm trying to do is create a class called block that defines a block and all it's properties, then call the block class for a basic description of a block every time I create an individual block with unique properties. I've tried extends which works, but I'd have to create a new extending class for every unique block, and I've tried creating an object but it won't work. All my searches turned up dry. Here's my code:
package src;
public class Block {
//Defines a Block
double id; //Full = type, decimal = subtype
String type; //Name/tooltip
int sound; //Type of sound played on collision
int light; //Ammount of light given off
boolean breaks; //Wether the block is breakable
boolean solid; //Wether the block has collision detection
}
How can I go about calling this object multiple times in a different class, each time with all the values slightly different?
statichere at all. This code doesn't actually do anything, either; it just defines a class. How are you trying to use it?