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: One script and a lot of sprites  (Read 5685 times)

0 Members and 1 Guest are viewing this topic.

VEn0m

  • 85 lvl elf
  • Lurker
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • Live & Learn, Блеать!
    • View Profile
One script and a lot of sprites
« on: May 09, 2012, 11:22:07 AM »

I'm making a mini game in a quest. On the scene there are 10+ non-interactive sprite entities's images. The one you click on must disappear. Can I somehow make it by using only one script or I'll have to add a script for each of the sprites?

And once more

Code: [Select]
on "Keypress"
{
  if (Keyboard.IsControl)
  {
  Game.Msg("bla bla");
  }
}
- working

Code: [Select]
on "Keypress"
{
  if (Keyboard.IsAlt)
  {
  Game.Msg("bla bla");
  }
}
-not working.

WTF? 
Logged

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 301
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: One script and a lot of sprites
« Reply #1 on: May 09, 2012, 08:26:53 PM »

Whats so hard about adding a script to each sprite? It is made automatically, and it just use the

on "LeftClick"
{
this.Visible = false;
}
Logged

VEn0m

  • 85 lvl elf
  • Lurker
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • Live & Learn, Блеать!
    • View Profile
Re: One script and a lot of sprites
« Reply #2 on: May 09, 2012, 08:31:07 PM »

Quote
Whats so hard about adding a script to each sprite? It is made automatically, and it just use the

on "LeftClick"
{
this.Visible = false;
}

20+ levels with 10+ sprites... I'm to lazy to do it with each sprite :)
Logged

Endrit

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 62
    • View Profile
Re: One script and a lot of sprites
« Reply #3 on: May 09, 2012, 10:33:45 PM »

Quote
Whats so hard about adding a script to each sprite? It is made automatically, and it just use the

on "LeftClick"
{
this.Visible = false;
}

20+ levels with 10+ sprites... I'm to lazy to do it with each sprite :)

LOL
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: One script and a lot of sprites
« Reply #4 on: May 10, 2012, 09:07:23 AM »

:)) If you name your sprites correctly, you can do:

Code: WME Script
  1.  
  2. for (var a=0;a<10;a = a+1)
  3. {
  4.     var ent = Scene.GetNode("mysprite" + a);
  5.     ent.AttachScript("path to script file");
  6. }
  7.  
  8.  
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

VEn0m

  • 85 lvl elf
  • Lurker
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • Live & Learn, Блеать!
    • View Profile
Re: One script and a lot of sprites
« Reply #5 on: May 11, 2012, 06:28:32 AM »

Thank you very much. That's exactly what I was looking for  ::rock
Logged
 

Page created in 0.024 seconds with 25 queries.