Skip to main content

News

Topic: [ EDITOR ] map layer issue (Read 4103 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
[ EDITOR ] map layer issue
So I'm trying to use SetLayerVisible(layer, visible) to you know, set the map layers to be visible or not ( first floor, second floor etc ).

erm I know that 'visible' is supposed to be replaced with either true or false. But what should 'layer' be replaced with? This is what I did:

Code: [Select]
SetLayerVisible( sfloor, false);


where sfloor is the name of the layer. But it told me that swall is not defined meaning it's treating it as a variable...I think. So what should I type then?

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: [ EDITOR ] map layer issue
Reply #1
How about the layer index? I know it's not too obvious. In fact SetLayerRenderer can use the layers name? So it can change depending on what call you use. Always assume the layer index by default, in fact always use the index since layers can be named the same, but will never have the same index.
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: [ EDITOR ] map layer issue
Reply #2
when ever passing a label of an object as an argument, u always want to enclose the label in quotes (single or double doesnt matter), without the quotes, sphere will think u mean the variable

Code: [Select]

SetLayerVisible( "sfloor", true )


however in this case, with this function, the argument LAYER should be the number that is the index of the layer:

Code: [Select]

SetLayerVisible( 0, true )


but if u want u can save the layer (or use a function to find the layer u want) in a variable and then use that variable.

Code: [Select]

var SECOND_FLOOR_LAYER = 3

SetLayerVisible( SECOND_FLOOR_LAYER, true )