Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: HIman on August 28, 2005, 08:06:02 AM

Title: How to transfer the image to component STATIC?
Post by: HIman on August 28, 2005, 08:06:02 AM
Example
scenes\start_logo\scr\credits.script
Code: [Select]
#include "scripts\base.inc"

var Caption = this.GetControl("credit");
var Caption_image = this.GetControl("credit_imge");

Game.PlayMusic("sounds\town_zombie_call1.ogg");
DoCredit("HIman present","sprites\logo.sprite");

Sleep(3600);
Game.StopMusic();
Sleep(1000);
HideCredit();
Sleep(500);

Game.PlayMusic("sounds\windchine1.ogg");
DoCredit("AKAVAKA present","sprites\2d_zast.sprite");
   
Sleep(3600);
Game.StopMusic();
Sleep(1000);
HideCredit();
Sleep(500);

this.Visible = false;

DoClose();


////////////////////////////////////////////////////////////////////////////////
function DoClose()
{
Game.StopMusic();
        this.Close();
Game.ChangeScene("scenes\Menu\Menu.scene");
Game.UnloadObject(this);
}

////////////////////////////////////////////////////////////////////////////////
function DoCredit(Text, Image)
{
var i;

this.AlphaColor = RGB(255, 255, 255, 0);

Caption.Text = Text;

//   Not work
//        Caption_image.Image = Image;
//   Not work to
          Caption_image.SetImage(Image);


// show new credit
for(i = 0; i<=255; i=i+10)
{
this.AlphaColor = RGB(255, 255, 255, i);
Sleep(80);
}
this.AlphaColor = RGB(255, 255, 255, 255);
}

////////////////////////////////////////////////////////////////////////////////
function HideCredit()
{
var i;
// hide old credit
for(i = 255; i>=0; i=i-10)
{
this.AlphaColor = RGB(255, 255, 255, i);
Sleep(20);
}

}

scenes\start_logo\scr\credits.window

Code: [Select]
WINDOW
{
  TRANSPARENT = TRUE
  SCRIPT = "scenes\start_logo\scr\credits.script"
  STATIC
  {
    NAME = "credit_image"
    X = 270
    Y = 100
  }
  STATIC
  {
    TEXT = ""
    TEXT_ALIGN = "center"
    NAME = "credit"
    FONT = "fonts\big_grey.font"
    X = 0
    Y = 568
    WIDTH = 800
    HEIGHT = 32
  }
}

The text works perfectly, but the image is not :(

If in scenes\start_logo\scr\credits.window to insert

Code: [Select]
WINDOW
{
  TRANSPARENT = TRUE
  SCRIPT = "scenes\start_logo\scr\credits.script"
  STATIC
  {
    NAME = "credit_image"
    X = 270
    Y = 100
    IMAGE = "sprites\logo.sprite"
  }
  STATIC
  {
    TEXT = ""
    TEXT_ALIGN = "center"
    NAME = "credit"
    FONT = "fonts\big_grey.font"
    X = 0
    Y = 568
    WIDTH = 800
    HEIGHT = 32
  }
}

That the picture is shown as it is necessary, but whereas it can be changed?
Title: Re: How to transfer the image to component STATIC?
Post by: Mnemonic on August 28, 2005, 08:16:11 AM
This should work:

  Caption_image.SetImage(Image);


But you seem to have a typo in the following line:

  var Caption_image = this.GetControl("credit_imge");
Title: Re: How to transfer the image to component STATIC?
Post by: HIman on August 28, 2005, 09:31:02 AM
Oh, forgive really I is not attentive.

But nevertheless has not earned.

Call to undefined method 'SetImage'. Ignored.
Title: Re: How to transfer the image to component STATIC?
Post by: Mnemonic on August 28, 2005, 12:24:33 PM
So, uh... does it work now? I tried the your script with the fixed typo and it works here.
Title: Re: How to transfer the image to component STATIC?
Post by: HIman on August 28, 2005, 04:41:10 PM
 It work! Thanks !!!!
You the wizard, that I only did not do{make} also a code checked
Also has written a pair of other scripts too the most realizing.
The doubt has already crept in that only TEXT it is possible to transfer,
and other parameters are not present.
I cannot explain why 4 hours back this code did not work, and now works.  :(