Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Create Sprite object in code...?  (Read 2166 times)

0 Members and 1 Guest are viewing this topic.

Kumilanka

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Create Sprite object in code...?
« on: February 05, 2010, 01:03:45 PM »

Hey, a quick question:

var str = new String(); // generates empty string object

Is it possible to create a Sprite object in the same manner? How about a Frame object? How do I do this?

Do I have to first add the sprite in the editor and then I can use it, or can I declare it in the script without touching the editor?
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: Create Sprite object in code...?
« Reply #1 on: February 05, 2010, 02:06:10 PM »

Code: WME Script
  1.  
  2. var tmp = Scene.CreateEntity("test");
  3. tmp.SetSprite("somefile.jpg");
  4. tmp.Active = true;
  5. tmp.X = 100;
  6. tmp.Y = 100;
  7.  
  8. //etc etc
  9.  
  10. // querying is simple too
  11. var node = Scene.GetNode("test");
  12. node.Active = false;
  13.  

Look at the manual for the similar ways of declaring other stuff.

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.047 seconds with 20 queries.