first version of floating image
[supertux.git] / data / levels / test / default.nut
1 /* Default functions for the whole levelset */
2
3 function intro()
4 {  
5   //initialize
6   SUPERTUX.set_action("stand-right");
7   RADIO.set_action("quiet");  
8   PENNY.set_action("stand-left");
9   NOLOK.set_visible(false);
10   local logo = FloatingImage("images/objects/logo/logo.sprite");
11   Tux.deactivate();
12   Tux.set_visible(false);
13   DisplayEffect.sixteen_to_nine(0);
14   
15   //begin scrolling sequence
16   DisplayEffect.fade_in(2);
17   Camera.scroll_to(0, 945, 15);
18   Sound.play("music/intro.ogg");
19   wait(3);
20   Text.set_text("Somewhere at the shores\nof Antarctica...");
21   Text.fade_in(2);
22   wait(3);
23   Text.fade_out(2);
24   wait(10);
25   SUPERTUX.set_velocity(50,0);
26   Camera.scroll_to(3100, 945, 18);
27   wait(10);
28   logo.set_anchor_point(ANCHOR_TOP);
29   logo.set_pos(0, 50);
30   logo.set_visible(true);
31   wait(5);
32   logo.set_visible(false);
33   wait(6);
34   
35   //begin conversation and Tux rap
36   SUPERTUX.set_velocity(0,0);
37   Sound.play("speech/tux_hello.ogg");
38   wait(3);
39   Sound.play("speech/penny_runt_01.ogg");
40   wait(1);
41   Sound.play("speech/tux_murp_01.ogg");
42   wait(1);
43   RADIO.set_action("loud");
44   Sound.play("speech/tux_rap.ogg");
45   wait(15);
46   shake_bush();
47   wait(2);
48   shake_bush();
49   wait(2);
50   shake_bush();
51   wait(1.3);
52   
53   //enter Nolok
54   NOLOK.set_velocity(-220, 600);
55   NOLOK.set_visible(true);
56   DisplayEffect.fade_out(1.3);
57   wait(3);
58
59   //darkness
60   NOLOK.set_visible(false);
61   PENNY.set_visible(false);
62   RADIO.set_action("quiet");
63   SUPERTUX.set_pos(3550, SUPERTUX.get_pos_y());
64
65   //wake up, Tux...
66   DisplayEffect.fade_in(4);
67   wait(4);
68   Sound.play("speech/tux_upset.ogg");
69   wait(3);
70   tux_upset();
71   wait(1);
72   tux_upset();
73   wait(4);
74   SUPERTUX.set_action("stand-right");
75   SUPERTUX.set_velocity(300,0);
76   wait(2);
77   
78   //end intro sequence
79   DisplayEffect.fade_out(2);
80   wait(3);
81   Level.finish();
82 }
83
84 function shake_bush()
85 {
86   //Sound.play("sounds/rustle.wav");
87   local bushx = BUSH.get_pos_x();
88   local bushy = BUSH.get_pos_y();
89   for(local i = 0; i < 20; ++i) {
90     BUSH.set_pos(bushx + rand() % 6 - 3, bushy);
91     wait(0.05);
92   }
93 }
94
95 function tux_upset()
96 {
97   SUPERTUX.set_action("stand-right");
98   SUPERTUX.set_velocity(200,0);
99   wait(0.3);
100   SUPERTUX.set_velocity(0,0);
101   wait(0.4);
102   SUPERTUX.set_action("stand-left");
103   SUPERTUX.set_velocity(-200,0);
104   wait(0.3);
105 }
106