Author Topic: Need some coding help  (Read 1683 times)

Offline Chibikiba

  • Familiar Grounds Dweller
  • **
  • Posts: 52
  • Floof-O-Meter: 1
    • View Profile
Need some coding help
« on: July 26, 2012, 06:54:03 pm »
Ok so i have a plan for map that needs blocks that are visible for few seconds, then disappear for few seconds, appear for few seconds etc, but i can't figure out what code to use to make it happen.

I have tried using these codes

material palikkaMat
{
   technique
   {
      pass
      {
      lighting off
      scene_blend colour_blend
      depth_write off
      cull_hardware none
      cull_software none
         texture_unit
         {
           texture p2.png
           tex_address_mode wrap
           filtering trilinear
         }
         texture_unit
         {
            texture p1.png
      scroll_anim 0.01 0.02
      tex_address_mode wrap
      rotate_anim -0.01
      wave_xform scale_x sine 3 0.1 0 3
      wave_xform scale_y sine 3 0.1 0 3         
            colour_op alpha_blend
         }
         texture_unit
         {
            texture p2.png
            colour_op_ex blend_current_alpha src_texture src_current
         }
      }
   }
}


and

material palikkaMat
{
    receive_shadows on
    technique
    {
        pass
        {
            ambient 1.000000 1.000000 1.000000 1.000000
            diffuse 1.000000 1.000000 1.000000 1.000000
            specular 0.010000 0.010000 0.010000 1.000000
            emissive 0.000000 0.000000 0.000000 1.000000
            texture_unit
            {
                anim_texture p1.png p1.png 4.0
                tex_address_mode wrap
                filtering trilinear
                rotate_anim 0.00
         }
      }
   }
}


As you can see, i have 2 textures p1 and p2(p2 is transparent)
With first code the box just stood there being slightly transparent, with second one it did chance texture but the one that was transparent(and png) showed up as black.

Offline Ruby1234

  • Mean Tutorial Queen
  • Elder Grey Pelt
  • ****
  • Posts: 2,794
  • Country: us
  • Floof-O-Meter: 297
  • aka Phloxenfree.
    • View Profile
Re: Need some coding help
« Reply #1 on: July 26, 2012, 08:28:20 pm »
If you're trying to make it disappear for a few seconds and then reappear, I recommend using the anim_texture code, as you have done. I'm not sure why it turned out black, but perhaps try this one.

Code: [Select]
material palikkaMat
{
technique
{
pass
{
cull_hardware none
cull_software none
alpha_rejection greater_equal 128
texture_unit
{
anim_texture p1.png p2.png 4
}
}
}
}

Offline Chibikiba

  • Familiar Grounds Dweller
  • **
  • Posts: 52
  • Floof-O-Meter: 1
    • View Profile
Re: Need some coding help
« Reply #2 on: July 26, 2012, 08:52:40 pm »
That works :D thanks