Scrolling Game Development Kit Forum

SGDK Version 2 => Help, Errors, FAQ => Topic started by: SmartBoy16 on 2010-01-09, 12:51:54 AM

Title: Layer questions
Post by: SmartBoy16 on 2010-01-09, 12:51:54 AM
Is there a way to hide or show a layer in runtime?  Same question for reordering layers?
Title: Re: Layer questions
Post by: Tanja on 2010-01-09, 04:56:43 AM
hide and show is possible, bluemonk (or durnurd?) once wrote a script for me. i don't have it here, though.
Title: Re: Layer questions
Post by: bluemonkmn on 2010-01-09, 07:45:07 AM
You could edit LayerBase.cs to add a property like
Code: [Select]
public bool isVisible = true;

Then edit the Draw function ("public void Draw()") so that it doesn't do anything if the layer is set to be be invisible:

Code: [Select]
if (!isVisible) return;

Whenever you want to show or hide the layer, just set its isVisible property.
Title: Re: Layer questions
Post by: SmartBoy16 on 2010-01-09, 10:49:21 AM
(who knew it was that simple?)   this helps, thanks!!!