default.nut 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * This script gets loaded into the squirrel root vm in supertux. So functions
  3. * and variables you define here can be used in all threads
  4. */
  5. //Create Level table
  6. Level <- {
  7. finish=Level_finish,
  8. has_active_sequence=Level_has_active_sequence,
  9. spawn=Level_spawn,
  10. spawn_transition=Level_spawn_transition,
  11. set_start_point=Level_set_start_point,
  12. set_start_pos=Level_set_start_pos,
  13. set_respawn_point=Level_set_respawn_point,
  14. set_respawn_pos=Level_set_respawn_pos,
  15. flip_vertically=Level_flip_vertically,
  16. toggle_pause=Level_toggle_pause,
  17. pause_target_timer=Level_pause_target_timer,
  18. resume_target_timer=Level_resume_target_timer
  19. };
  20. function end_level()
  21. {
  22. play_music("music/misc/leveldone.ogg");
  23. Tux.deactivate();
  24. wait(6);
  25. Effect.fade_out(2);
  26. wait(2);
  27. Level.finish(true);
  28. }
  29. function exit_worldmap()
  30. {
  31. wait_for_screenswitch();
  32. exit_screen();
  33. }
  34. function levelflip()
  35. {
  36. Effect.fade_out(1);
  37. wait(1);
  38. Level.flip_vertically();
  39. Effect.fade_in(1);
  40. }
  41. function println(val)
  42. {
  43. print(val);
  44. print("\n");
  45. }
  46. if(! ("state" in this))
  47. state <- {};