Author Topic: Layer questions  (Read 2501 times)

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Layer questions
« 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?
Looking to the skies.....

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: Layer questions
« Reply #1 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.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Layer questions
« Reply #2 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.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: Layer questions
« Reply #3 on: 2010-01-09, 10:49:21 AM »
(who knew it was that simple?)   this helps, thanks!!!
Looking to the skies.....