Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualAndy474

Posted 21 May 2013 - 09:39 AM

Hmm your Shuriken object doesnt need to hold 'n' Spike objects, Thats a waste of space.

 

Personally I'd just have a a yield function in the Shuriken object (or Deconstruct) which returns 'n' number of NEW Spike objects and a core.

 

So for instance:

 

Stage 1: Player inventory

 

4 x Spikes
1 x Core

 

Stage 2: Player visits a workbench turns the 4 spikes and 1 core into 1 Shuriken Object.

 

Stage 3: Player receives 1 Shuriken, their inventory is now

 

1 x Shuriken

 

The Shuriken object holds the number of spikes used to create it, (as an INTEGER) and then when the player deconstructs the object

 

 

object[] Deconstruct()
{ return 1x core and 'n' Spikes. }

 

So the spikes returned are new objects.

 

In terms of Creating Weapons, I would have a base "WeaponBase" class which knows what "Component" object(s) it needs to make the Weapon and use inhertiance so: class UberLongSword extends WeaponBase.

 

So a Iron Sword knows it needs 4x Iron Ingots and 1xWooden stick to make.


#2Andy474

Posted 21 May 2013 - 09:38 AM

Hmm your Shuriken object doesnt need to hold 'n' Spike objects, Thats a waste of space.

 

Personally I'd just have a a yield function in the Shuriken object (or Deconstruct) which returns 'n' number of NEW Spike objects and a core.

 

So for instance:

 

Stage 1: Player inventory

 

4 x Spikes
1 x Core

 

Stage 2: Player visits a workbench turns the 4 spikes and 1 core into 1 Shuriken Object.

 

Stage 3: Player receives 1 Shuriken, their inventory is now

 

1 x Shuriken

 

The Shuriken object holds the number of spikes used to create it, (as an INTEGER) and then when the player deconstructs the object

 

 

object[] Deconstruct()
{ return 1x core and 'n' Spikes. }

 

So the spikes returned are new objects.

 

In terms of Creating Weapons, I would have a base "WeaponBase" class which knows what "Component" object(s) it needs to make the object.

 

So a Iron Sword knows it needs 4x Iron Ingots and 1xWooden stick to make.


#1Andy474

Posted 21 May 2013 - 09:34 AM

Hmm your Shuriken object doesnt need to hold 'n' Spike objects, Thats a waste of space.

 

Personally I'd just have a a yield function in the Shuriken object (or Deconstruct) which returns 'n' number of NEW Spike objects and a core.

 

So for instance:

 

Stage 1: Player inventory

4 x Spikes
1 x Core

 

Stage 2: Player visits a workbench turns the 4 spikes and 1 core into 1 Shuriken Object.

 

Stage 3: Player receives 1 Shuriken, their inventory is now

1 x Shuriken

 

The Shuriken object holds the number of spikes used to create it, (as an INTEGER) and then when the player deconstructs the object

 

object[] Deconstruct()
{ return 1x core and 'n' Spikes. }

 

So the spikes returned are new objects.


PARTNERS