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