threads_this_01.gm 351 B

1234567891011121314151617181920
  1. global my_entity = {
  2. x = 50, y = 100, name = "test"
  3. };
  4. global move_ent_left = function()
  5. {
  6. print( "Starting thread - this.name = " + .name );
  7. while( this.x > 0 )
  8. {
  9. this.x = this.x - 10;
  10. print( this.name + " - x = " + this.x );
  11. yield();
  12. }
  13. print( "Ending thread - this.name = " + .name );
  14. };
  15. my_entity:thread( move_ent_left );
  16. sleep(1);