Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Pages: [1] 2  All

Author Topic: z-sou?adnice  (Read 7654 times)

0 Members and 1 Guest are viewing this topic.

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
z-sou?adnice
« on: January 02, 2007, 06:02:49 PM »

Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: z-sou?adnice
« Reply #1 on: January 02, 2007, 06:56:31 PM »

jsou to 2D nebo 3D entity? (myslis jako entitu sprite nebo 3D model)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #2 on: January 02, 2007, 07:14:14 PM »

Code: [Select]
 
  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
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: z-sou?adnice
« Reply #3 on: January 02, 2007, 07:34:03 PM »

var sp = en.GetSpriteObject();

GetSprite vraci nazev souboru.

ta perspektiva u sprite entity se resi pomoci prepoctu a zmenseni.

Perspektivni korekce souradnic se pocita takhle:

http://en.wikipedia.org/wiki/3D_projection#Simple_version

a pak je jeste potreba pouzit scale aby se entita do dalky zmensovala.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #4 on: January 02, 2007, 07:59:27 PM »

Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: z-sou?adnice
« Reply #5 on: January 02, 2007, 08:09:19 PM »

aha, no tohle jde jednoduse. Vytvor si regiony pro kazdou "vrstvu", ktere si ve Scene Editoru nejak pojmenuj.

Potom dej

en.StickToRegion("nazev vrstvy"); podle toho, v jake vrstve chces entity mit.

Tim zajistis podobne prekryvani jako kdybys entity seradil ve scene editu.

Je to to, co potrebujes?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #6 on: January 02, 2007, 08:15:14 PM »

Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: z-sou?adnice
« Reply #7 on: January 02, 2007, 09:34:39 PM »

a co je spatne na:

var e = Scene.CreateEntity();
var sp = e.GetSpriteObject();
sp.CurrentFrame = 5;

?

(netestoval jsem to, ale melo by to jet)

Edit: samozrejme po CreateEntity by melo nasledovat SetSprite.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5679
    • View Profile
    • Dead:Code Site
Re: z-sou?adnice
« Reply #8 on: January 02, 2007, 09:37:19 PM »

Jo jo, tohle by melo fungovat. V podstate ten puvodni kod, jen se v nem zmeni GetSprite() na GetSpriteObject(), jak uz rikal meta.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #9 on: January 02, 2007, 10:13:26 PM »

Code: [Select]
  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]

Prirazeni  sp.CurrentFrame = 4; proste nefunguje a sprit se mi cely prehraje a skonci na poslednim snimku (na desatem).                       

Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: z-sou?adnice
« Reply #10 on: January 03, 2007, 12:14:58 AM »

protoze tam mas sp.GurrentFrame namisto sp.CurrentFrame

jo a jeste zkus zavolat pred nastavenim CurrentFrame sp.Reset();

jen se ujistim, ten sprite funguje? hod sem pro jistotu definici.
« Last Edit: January 03, 2007, 12:17:05 AM by metamorphium »
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #11 on: January 03, 2007, 04:12:30 PM »

Logged

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #12 on: January 03, 2007, 04:42:37 PM »

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5679
    • View Profile
    • Dead:Code Site
Re: z-sou?adnice
« Reply #13 on: January 03, 2007, 10:02:10 PM »

Entity, vytvorene pres Game.CreateEntity() jsou v pameti az do konce hry, pak se zrusi. Pokud se pouzije Scene.CreateEntity(), tak se zrusi pri zmene sceny.
Prochazet se daji jen staticke entity. Dynamicky vytvorene si budes muset pamatovat v tom poli, obavam se.

Jinak padat by to kazdopadne nemelo. Pokud bys mel nejaky miniprojekt, kde se da to padani nasimulovat, tak bych ho docela rad videl a projel si ho debuggerem..
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Siky

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 41
    • View Profile
Re: z-sou?adnice
« Reply #14 on: January 03, 2007, 10:29:11 PM »

Ukazku z projektu, kter?? pad??, jsem ti poslal emailem
Logged
Pages: [1] 2  All
 

Page created in 0.135 seconds with 23 queries.