Skip to main content

News

Topic: Maintaining a battle combatants array separately (Read 4932 times) previous topic - next topic

Re: Maintaining a battle combatants array separately
Reply #15
still for a beginner to have 50 scripts? How big is the project?

Re: Maintaining a battle combatants array separately
Reply #16
i dont know how big big is. sorry, 50 was an exaggeration. i could prolly have 50 objects but i have like 30 something right now is all. still havent designed half the objects that i will need for content of the first episode tho

edit: clarity

reedit2: is there any limits to inheritance chains in sphere or javascript? or maybe im just chaining too long... a 7th gen object has lost properties that it got at gen 4. strangly tho it keeps them from 5 and 6?

edit to my edit while i was editing: no it was cause i assume the components i put in the prototypes of the early gens dont carry over to the later gens, cause they in the prototypes of the early gens, and not in the later ones!

edit: nvm, u can add components into a prototype, and they will be there, i had hacked a component at gen 4, and thats why it wasnt getting added correctly, i fixed that up and now the Combatant Objects are properly adding the Vector Object's Vector_Component.Movable = {}. science is cool.
  • Last Edit: June 18, 2013, 06:17:01 pm by ninjasword

Re: Maintaining a battle combatants array separately
Reply #17
The answer to how long (at least the spec minimum) an inheritance chain can be for Sphere's javascript probably lies in the EcmaScript 3rd Edition Specification, if it can be found anywhere. I'm not sure there properly is a limit, though, I think you'd have OOM errors before such things happened. You could always test it.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Maintaining a battle combatants array separately
Reply #18
8 levels of inheritance is considered an industry maximum. If you go beyond that, you have classified things deeper than an anthropologist having a field day with a time machine.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

Re: Maintaining a battle combatants array separately
Reply #19

8 levels of inheritance is considered an industry maximum.


i could shrink it down a little, the 7th gen object is a combatant object so its pretty much at the end of the chain there, not to mention (and i prolly shouldnt do this) the first thing in the chain is just an object that has an extend method built in (for learning the components).

right now tho i am trying to figure out the map layers (i want to render a special hud/ui layer UNDER the map persons. the ui of sphere isnt exactly the most descriptive... im confused as to where the ground layer is, and if its possible to have panoramic/scrolling backgrounds, or if i should drop those layers from my design

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Maintaining a battle combatants array separately
Reply #20
To render stuff underneath entities you can use the SetLayerRenderer function.

Code: (javascript) [Select]

function GroundRender()
{
  // ... draw stuff that should go on the ground layer.
}

// set up a ground renderer on layer 0:
SetLayerRenderer(0, "GroundRender();");


It works exactly like a SetRenderScript, expect you can choose a particular layer to draw on.

As for scrolling/parallax layers you can go into the old editor and right click a layer in the layer panel and choose "properties". There you will see an option for scrolling and parallax. My newer editor doesn't have that yet.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Maintaining a battle combatants array separately
Reply #21
Yea, I use SetLayerRenderer pretty liberally in my NShoot demo 'Artyxx' ; works pretty well for the scrolling BG.

(edit - clouds overlay! I knew I was forgetting something!)
  • Last Edit: June 19, 2013, 05:23:34 pm by N E O