This repository has been archived on 2024-02-25. You can view files and clone it, but cannot push or open issues or pull requests.
spaaace/src/MainScene.hx

57 lines
979 B
Haxe
Raw Normal View History

2014-07-05 17:00:35 +02:00
import com.haxepunk.Scene;
import com.haxepunk.HXP;
import com.haxepunk.graphics.Backdrop;
import com.haxepunk.Sfx;
2014-07-05 17:00:35 +02:00
import Spawner;
import Player;
import Button;
import Enemy;
import Lives;
import Score;
2014-07-05 17:00:35 +02:00
class MainScene extends Scene
{
public override function begin()
{
backdrop = new Backdrop("graphics/darkPurple.png", true, true);
var player = new Player();
2014-07-05 17:00:35 +02:00
var button = new Button();
var spawner = new Spawner();
var lives = new Lives();
var score = new Score();
#if flash
music = new Sfx("audio/loop.mp3");
#else
music = new Sfx("audio/loop.wav");
#end
2014-07-05 17:00:35 +02:00
addGraphic(backdrop);
#if (android || ios)
add(button);
#end
add(player);
add(lives);
add(score);
2014-07-05 17:00:35 +02:00
add(spawner);
music.play(.1, 0, true);
}
public override function end() {
this.removeAll();
music.stop();
this.update();
2014-07-05 17:00:35 +02:00
}
public override function update() {
super.update();
backdrop.y += 1;
}
private var backdrop:Backdrop;
private var music:Sfx;
2014-07-05 17:00:35 +02:00
}