Skip to content

Objects

James McNair edited this page Apr 2, 2019 · 1 revision

Objects

Objects are used in cases where all other methods have been exhausted. So the code required cannot be done in an Interactable. Reasons for using an object:

  • Custom rending method
  • Rotational support

Modifying objects

All default objects are contained in the com.booksaw.corruption.object package.

Creating a new object

Creating the class

  • Create the class: public class Foo extends GameObject
  • Edit all implementable methods.
  • Create toString method to get the file output.
  • Make the constructor Foo(String reference) where the reference is the line from which the object can be loaded from.
  • Make the constructor Foo(Point p) or similar for creating new objects.

Adding the required references for the GameObject to be loaded

  • In ObjectList add the object to the enum and alter all methods to include references to the new object.
  • In LevelManager find the private method public void makeObject(String ref) and modify with a custom reference for the object (should be the same as the reference in toString

Clone this wiki locally