1
Technické fórum / Re: globální pole
« on: June 26, 2007, 05:40:42 PM »
Jo diky, to bylo ono
var array1 = new Array();
function napln_data()
{
var temp1;
var array2 = new Array();
for (var j=0; j<3; j=j+1)
{
for (var i=0; i<3; i=i+1)
{
array2[i] = 10*i+j;
Game.LOG(array2[i]);
}
temp1.array = array2;
array1[j] = temp1;
}
}
function vypis_data()
{
var t;
var t2;
for (var j=0; j<3; j=j+1)
{
t = array1[j];
for (var i=0; i<3; i=i+1)
{
t2 = t.array;
Game.LOG(t2[i]);
}
}
napln_data();
Game.LOG("----------");
vypis_data();
19:16: 0
19:16: 10
19:16: 20
19:16: 1
19:16: 11
19:16: 21
19:16: 2
19:16: 12
19:16: 22
19:16: ----------
19:16: 2
19:16: 12
19:16: 22
19:16: 2
19:16: 12
19:16: 22
19:16: 2
19:16: 12
19:16: 22
sp.Play();
sp.Reset();
sp.Play();
var en = Scene.CreateEntity("jmeno");
en.SetSprite("sprites/body.sprite");
en.AttachScript("scripts/body.script");
var sp = en.GetSpriteObject();
Game.Msg("sp = " + sp ); // toto je OK
sp.CurrentFrame = 4;
Game.Msg("sp.name = " + sp.Name); // toto je OK
Game.Msg("sp.curr = " + sp.GurrentFrame); // toto vraci porad [null]
var en = Game.CreateEntity("jmeno_body");
en.SetSprite("sprites/body.sprite");
en.AttachScript("scripts/body.script");
var sp = en.GetSprite();
sp.CurrentFrame = 4; // tohle nefunguje
Game.Msg(sp.CurrentFrame); // tohle vraci null