Forced 720p and added tutorial overlay. Also added score to Boss.hx

This commit is contained in:
Bram van der Veen 2014-07-27 12:19:28 +02:00
parent 73eb9fbf52
commit cfa3a60528
6 changed files with 55 additions and 10 deletions

View file

@ -6,7 +6,7 @@
<window fps="60" background="0x000000" />
<window width="360" height="640" resizable="false" unless="mobile" />
<window orientation="portrait" fullscreen="true" if="mobile" />
<window orientation="portrait" height="1280" width="720" fullscreen="true" if="mobile" />
<window orientation="portrait" vsync="true" antialiasing="8" if="cpp" />
<source path="src" />

View file

@ -91,6 +91,12 @@ class Boss extends Entity {
var bullet:Entity = this.collide("bullet", this.x, this.y);
var heavybullet:Entity = this.collide("heavybullet", this.x, this.y);
if (bullet != null || heavybullet != null) {
var score:Array<Score> = [];
this.scene.getClass(Score, score);
score[0].add(1500);
}
if (bullet != null) {
if (Save.load().laser == 0)
damage = 1;

View file

@ -10,6 +10,7 @@ import Enemy;
import Lives;
import Score;
import Overlay;
import Save;
class MainScene extends Scene
{
@ -39,7 +40,9 @@ class MainScene extends Scene
add(lives);
add(score);
add(spawner);
add(new Overlay());
if (Save.load().overlay)
add(new Overlay());
music.play(.1, 0, true);
}

View file

@ -33,7 +33,7 @@ class MenuButton extends Entity {
this.addGraphic(sprite);
this.addGraphic(text);
this.layer = -5;
this.layer = -11;
Input.define("enter", [Key.ENTER, Key.SPACE]);
}

View file

@ -1,7 +1,9 @@
import com.haxepunk.Entity;
import com.haxepunk.graphics.Image;
import com.haxepunk.HXP;
import com.haxepunk.graphics.Text;
import com.haxepunk.HXP;
import com.haxepunk.utils.Input;
import openfl.Assets;
class Overlay extends Entity {
@ -25,7 +27,8 @@ class Overlay extends Entity {
shield.scale = thingy.scale = star.scale = 1.5;
var pickupText:Text = new Text("Pick up these things for repairs,\nstars for money,\nshield for shielding from damage.");
pickupText.y = -400; pickupText.x += 70; pickupText.size = 25; pickupText.centerOrigin();
pickupText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
pickupText.y = -400; pickupText.x += 90; pickupText.size = 25; pickupText.centerOrigin();
this.addGraphic(thingy); this.addGraphic(star); this.addGraphic(shield); this.addGraphic(pickupText);
@ -33,19 +36,51 @@ class Overlay extends Entity {
//Init asteroids
var meteor:Image = new Image("graphics/meteorBrown_big1.png");
meteor.y -= 200; meteor.x -= 300; this.addGraphic(meteor);
var meteorText:Text = new Text("Avoid these, they'll kill you.");
var meteorText:Text = new Text("Avoid these, they'll kill you."); meteorText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
meteorText.size = 25; meteorText.centerOrigin(); this.addGraphic(meteorText); meteorText.y -= 170; meteorText.x += 70;
//Init enemies
var enemy:Image = new Image("graphics/enemyGreen1.png");
enemy.x -= 300; this.addGraphic(enemy);
var enemyText:Text = new Text("These guys 'll try to shoot you,\nshoot back.");
var enemyText:Text = new Text("These guys 'll try to shoot you,\nshoot back."); enemyText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
enemyText.x += 70; enemyText.y += 50; enemyText.size = 25; enemyText.centerOrigin(); this.addGraphic(enemyText);
//Go to the store
var dollar:Text = new Text("$");
var dollar:Text = new Text("$", {color: 0xFFF000}); dollar.size = 100; dollar.x -= 230; dollar.centerOrigin(); dollar.y += 200;
dollar.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
var dollarText:Text = new Text("Make money to buy stuff at the\nstore (It'll make the game easier).");
dollarText.size = 25; dollarText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName; dollarText.x += 130;
dollarText.centerOrigin();
dollarText.y += 210;
this.addGraphic(dollar); this.addGraphic(dollarText);
//Ok button
var buttonText:Text = new Text("Ok", {color: 0x000000});
buttonText.size = 40; buttonText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
buttonText.centerOrigin();
button = new Image("graphics/buttonGreen.png");
button.scale = 2; button.centerOrigin();
button.y = buttonText.y = HXP.halfHeight - 200;
this.addGraphic(button); this.addGraphic(buttonText);
}
public override function update() {
super.update();
if (Input.mousePressed) {
if (Input.mouseY > HXP.halfHeight - 250) {
Save.save("overlay", false);
this.scene.remove(this);
}
}
}
private var overlay:Image;
private var button:Image;
}

View file

@ -20,7 +20,8 @@ class Save extends Entity {
"ship_color" : Data.readInt("ship_color", 1),
"laser" : Data.readInt("laser", 0),
"has_heavy_laser" : Data.readBool("heavy_laser", false),
"money" : Data.readInt("money", 1000)
"money" : Data.readInt("money", 1000),
"overlay" : Data.readBool("overlay", true)
};
return data;
@ -34,11 +35,11 @@ class Save extends Entity {
Data.write("laser", "laserGreen04.png");
Data.write("heavy_laser", false);
Data.write("money", 1000);
Data.write("overlay", true);
Data.save("save/savegame.save", true);
trace("Reset savefile");
}
}