Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8260993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:14:52+00:00 2026-06-08T03:14:52+00:00

I have recently begun coding a 3d computer game as part of my IB

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:14:54+00:00Added an answer on June 8, 2026 at 3:14 am

    You could have a constructor for a Block as follows:

    public Block(double id, String type, int sound, int light, boolean breaks, boolean solid) {
        this.id = id;
        this.type = type;
        this.sound = sound;
        this.light = light;
        this.breaks = breaks;
        this.solid = solid;
    }
    

    With this, you can create as many different kinds of Blocks as you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently begun a new project which runs on remote computer. I usually
I've recently begun coding in Java in the past few months. I have a
I have recently begun writing unit tests (using GoogleTest ) for a C++ project.
Project Euler I have recently begun to solve some of the Project Euler riddles.
I've recently begun a fairly small 2D project using SFML and TinyXML and have
I have recently begun to think about optimisation, now I know there are many
I have recently begun to develop a game in Haxe which targets the Flash
I have recently begun game development, working mainly with C++ and SDL. After creating
I have recently begun delving into the world that is database programming with C++
I have recently begun working on a pre-existing PHP application, and am having a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.