Skip to content

Commit

Permalink
ass
Browse files Browse the repository at this point in the history
  • Loading branch information
SpunBlue committed May 17, 2022
1 parent 20f1a9c commit c186a97
Showing 8 changed files with 30 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Project.xml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
<window if="html5" resizable="false" />

<!--Desktop-specific-->
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" />
<window if="desktop" orientation="landscape" fullscreen="true" resizable="false" />

<!--Mobile-specific-->
<window if="mobile" orientation="portrait" fullscreen="false" width="576" height="1024" resizable="false"/>
@@ -90,4 +90,4 @@
<setenv name="GooglePlayID" value="" if="android"/>

<android target-sdk-version="26" />
</project>
</project>
Binary file removed assets/images/background.png
Binary file not shown.
Binary file removed assets/images/ground.png
Binary file not shown.
Binary file added assets/images/mobilebg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions source/GameOverState.hx
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import openfl.system.System;

class GameOverState extends FlxState
{
@@ -37,6 +38,13 @@ class GameOverState extends FlxState
var enterText:FlxText = new FlxText(0, FlxG.height / 2 + 150, FlxG.width, "Press Enter or Tap to Play Again");
enterText.setFormat(AssetPaths.prstart__ttf, 20, 0xffffffff, "center");
add(enterText);

// press x to exit
#if desktop
var exitText:FlxText = new FlxText(0, FlxG.height - 50, FlxG.width, "Press X to Exit");
exitText.setFormat(AssetPaths.prstart__ttf, 20, 0xffffffff, "center");
add(exitText);
#end
}

override public function update(elapsed)
@@ -58,5 +66,10 @@ class GameOverState extends FlxState
PlayState.score = 0;
FlxG.switchState(new PlayState());
}

#if desktop
if (FlxG.keys.anyJustPressed([X, ESCAPE]))
System.exit(0);
#end
}
}
1 change: 1 addition & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ class Main extends Sprite
public function new()
{
super();

addChild(new FlxGame(0, 0, MainMenuState));
}
}
10 changes: 10 additions & 0 deletions source/MainMenuState.hx
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import flixel.FlxG;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import openfl.system.System;

class MainMenuState extends FlxState
{
@@ -25,6 +26,10 @@ class MainMenuState extends FlxState
creditsText.setFormat(AssetPaths.prstart__ttf, 8, 0xFFFFFFFF, "center");
add(creditsText);

// exit game button
var exitButton:FlxButton = new FlxButton(FlxG.width - 50, 0, "X", exitGame);
add(exitButton);

// settings button
/*var settingsButton:FlxButton = new FlxButton(FlxG.width / 2 - 50, FlxG.height / 2 + 100, "Settings", settingsButt);
add(settingsButton); */
@@ -46,4 +51,9 @@ class MainMenuState extends FlxState
FlxG.switchState(new SettingsState());
#end
}

function exitGame()
{
System.exit(0);
}
}
17 changes: 4 additions & 13 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ class PlayState extends FlxState
{
var player:Player;

var ground:FlxSprite;
var pipeTop:FlxSprite;
var pipeBottom:FlxSprite;
var pipePieceBottom:FlxSprite;
@@ -35,29 +34,21 @@ class PlayState extends FlxState
{
super.create();

// create background
var backgroundCol:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, 0xFF96FFFF);
add(backgroundCol);

var background:FlxSprite = new FlxSprite(0, 0, AssetPaths.background__png);
background.setGraphicSize(FlxG.width);
var background:FlxSprite = new FlxSprite(0, 0, AssetPaths.mobilebg__png);
background.setGraphicSize(FlxG.width, FlxG.height);
background.updateHitbox();
background.setPosition(0, FlxG.height - background.height);
add(background);

ground = new FlxSprite(0, 0, AssetPaths.ground__png);
ground.setGraphicSize(FlxG.width);
ground.updateHitbox();
ground.y = FlxG.height - ground.height;
add(ground);

scoreUI = new FlxText(0, 0, FlxG.width, "0");
scoreUI.setFormat(AssetPaths.prstart__ttf, 64, 0xFFFFFFFF, "center");
scoreUI.y = FlxG.height - scoreUI.height;
uiTextGroup.add(scoreUI);
add(scoreUI);

player = new Player(24, FlxG.height * 0.5);
player = new Player(FlxG.width * 0.5, FlxG.height * 0.5);
add(player);

createPipe();
@@ -71,7 +62,7 @@ class PlayState extends FlxState

scoreUI.text = "" + score;

if (player.y <= 0 || player.y >= FlxG.height - (ground.height * 0.5))
if (player.y <= 0 || player.y >= FlxG.height - 124)
{
FlxG.switchState(new GameOverState());
}

0 comments on commit c186a97

Please sign in to comment.