-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitleScreen.as
50 lines (43 loc) · 1.21 KB
/
TitleScreen.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
package
{
import net.flashpunk.World;
import net.flashpunk.FP;
import net.flashpunk.utils.Input;
import net.flashpunk.utils.Key;
import net.flashpunk.graphics.Image;
public class TitleScreen extends World
{
private var level:Level;
private var graphic:Image;
public function TitleScreen() {
level = new Level(0, GC.levelData[0], Level.M_BUFFERED | Level.M_PLAYBACK, resetLevel);
level.begin();
graphic = (addGraphic(new Image(level.worldBuffer)).graphic as Image);
}
public function menu():void {
// TODO: implement a menu and move to it
removeAll();
FP.world = new Level(1, GC.levelData[1]);
//FP.world = new LevelSelect();
}
override public function update():void {
if (Input.pressed(Key.SPACE)) {
menu();
}
level.update();
level.updateLists();
level.render();
graphic.updateBuffer();
}
public function resetLevel(tmp:Level = null):void {
level.removeAll();
level.end();
level.updateLists();
level = new Level(0, GC.levelData[0], Level.M_BUFFERED | Level.M_PLAYBACK, resetLevel);
level.begin();
level.updateLists();
graphic = (addGraphic(new Image(level.worldBuffer)).graphic as Image);
}
}
}
// vim: foldmethod=indent:cindent