-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIntroWorld.as
72 lines (59 loc) · 1.47 KB
/
IntroWorld.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package {
import net.flashpunk.World;
import flash.geom.Point;
import net.flashpunk.graphics.Text;
import net.flashpunk.Entity;
import net.flashpunk.utils.Input;
import net.flashpunk.utils.Key;
import net.flashpunk.FP;
import net.flashpunk.Sfx;
import net.flashpunk.graphics.Image;
/**
* @author jamescarpenter
*/
public class IntroWorld extends World
{
private var waited:Boolean = false;
[Embed(source = 'graphics/intro.png')] private const INTRO:Class;
public var intro:Image = new Image(INTRO);
[Embed(source = 'graphics/select.png')] private const SELECT:Class;
public var select:Image = new Image(SELECT);
[Embed(source = 'audio/introwaltz.mp3')] private const WALTZ:Class;
public var waltz:Sfx = new Sfx(WALTZ);
public var level: int;
public function IntroWorld(l: int)
{
level = l;
}
override public function begin():void
{
FP.log("IntroWorld.begin");
if(level == 5)
{
FP.world = new WinWorld();
return;
}
var statusentity:Entity = new Entity();
statusentity.graphic = intro;
add(statusentity);
var selectentity:Entity = new Entity();
selectentity.graphic = select;
selectentity.y = 146 + (level-1)*25;
add(selectentity);
waltz.loop(0.8);
FP.alarm(2, timeout);
}
override public function update():void
{
if(Input.check(Key.SPACE) && waited)
{
waltz.stop();
FP.world = new GameWorld(level);
}
}
public function timeout() :void
{
waited = true;
}
}
}