Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
12 changes: 6 additions & 6 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<!-- ____________________________ Window Settings ___________________________ -->

<!--These window settings apply to all targets-->
<window width="192" height="156" fps="60" background="#000000" hardware="true" vsync="true" />
<window width="1200" height="780" fps="60" background="#000000" hardware="true" vsync="true" />

<!--HTML5-specific-->
<window if="html5" resizable="false" />

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

<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
Expand Down Expand Up @@ -63,10 +63,10 @@
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->

<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
<haxedef name="FLX_NO_MOUSE" />
<haxedef name="FLX_NO_MOUSE" unless="desktop" />
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" if="desktop" />
<!--<haxedef name="FLX_NO_GAMEPAD" />-->
<haxedef name="FLX_NO_GAMEPAD" unless="desktop" />

<!--Disable the Flixel core sound tray-->
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->
Expand All @@ -91,6 +91,6 @@
<icon path="misc/icon/icon64.png" size='64'/>
<icon path="misc/icon/icon256.png"/>

<assets path="LICENSE" rename="LICENSE.txt" />
<assets path="misc/readme.txt" rename="README.txt" />
<assets path="LICENSE" rename="LICENSE.txt" if="desktop"/>
<assets path="misc/readme.txt" rename="README.txt" if="desktop"/>
</project>
2 changes: 1 addition & 1 deletion assets/data/levels/level5.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"gridCellsX": 16,
"gridCellsY": 11,
"tileset": "DefaultTile",
"data": [9, -1, -1, 7, 8, 10, 14, 14, 14, 14, 15, -1, -1, -1, 7, 8, 9, -1, -1, 7, 10, 15, -1, -1, -1, -1, -1, -1, -1, 1, 17, 8, 16, 2, 2, 17, 9, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 8, 14, 14, 14, 11, 9, -1, -1, -1, 1, 2, 2, 3, -1, 7, 8, 8, -1, -1, -1, 7, 9, -1, -1, -1, 7, 8, 8, 9, -1, 7, 8, 8, -1, -1, -1, 13, 12, 5, -1, -1, 13, 14, 11, 9, -1, 7, 8, 8, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, 7, 9, -1, 7, 10, 14, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, 13, 15, -1, 13, 15, -1, 8, 16, 2, 2, 2, 3, -1, 1, 3, -1, -1, -1, -1, -1, -1, -1, 8, 8, 8, 8, 8, 16, -1, 17, 9, -1, -1, -1, -1, -1, -1, -1, 8, 8, 8, 8, 8, 8, -1, 8, 16, 2, 2, 2, 2, 2, 2, 2],
"data": [9, -1, -1, 7, 8, 10, 14, 14, 14, 14, 15, -1, -1, -1, 7, 8, 9, -1, -1, 7, 10, 15, -1, -1, -1, -1, -1, -1, -1, 1, 17, 8, 16, 2, 2, 17, 9, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 8, 14, 14, 14, 11, 9, -1, -1, -1, -1, 1, 2, 3, -1, 7, 8, 8, -1, -1, -1, 7, 9, -1, -1, -1, 1, 17, 8, 9, -1, 7, 8, 8, -1, -1, -1, 13, 12, 5, -1, -1, 13, 14, 11, 9, -1, 7, 8, 8, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, 7, 9, -1, 7, 10, 14, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, 13, 15, -1, 13, 15, -1, 8, 16, 2, 2, 2, 3, -1, 1, 3, -1, -1, -1, -1, -1, -1, -1, 8, 8, 8, 8, 8, 16, -1, 17, 9, -1, -1, -1, -1, -1, -1, -1, 8, 8, 8, 8, 8, 8, -1, 8, 16, 2, 2, 2, 2, 2, 2, 2],
"exportMode": 0,
"arrayMode": 0
},
Expand Down
79 changes: 0 additions & 79 deletions assets/data/levels/level7.json

This file was deleted.

Binary file modified assets/images/heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified misc/concepts/heart.aseprite
Binary file not shown.
Binary file added misc/concepts/mobile.aseprite
Binary file not shown.
Binary file added secret/images/mobile_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added secret/images/mobile_right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added secret/images/mobile_shot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added secret/images/mobile_up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions source/Game.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class Game
public static inline var MAP_HEIGHT:Int = 11;
public static inline var PIXEL_PERFECT:Bool = true;

public static inline var GAME_X:Int = 24;

public static function getGameWidth():Int
{
return TILE_WIDTH * MAP_WIDTH;
Expand Down
28 changes: 7 additions & 21 deletions source/Main.hx
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
package;

import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxState;
import flixel.system.FlxAssets.FlxShader;
import misc.FPSMem;
import misc.Input;
import openfl.Lib;
import openfl.display.Sprite;
import openfl.display.StageQuality;
import openfl.filters.ShaderFilter;
import openfl.system.Capabilities;

class Main extends Sprite
{
var _width:Int = 832;
var _height:Int = 676;
var _width:Int = 240;
var _height:Int = 156;
var _initialState:Class<FlxState> = SavanLogo;

public function new()
{
super();
addChild(new FlxGame(0, 0, _initialState, true));
addChild(new FlxGame(_width, _height, _initialState, true));
Input.init();
FlxG.game.setFilters([new ShaderFilter(new FlxShader())]);
FlxG.game.stage.quality = StageQuality.LOW;
FlxG.resizeWindow(_width, _height);

// Center window on screen
var screenWidth = Capabilities.screenResolutionX;
var screenHeight = Capabilities.screenResolutionY;
trace('Width: $screenWidth - Height: $screenHeight');

Lib.application.window.x = Std.int((screenWidth / 2) - (_width / 2));
Lib.application.window.y = Std.int((screenHeight / 2) - (_height / 2));

// FlxG.fullscreen = true;
#if debug
addChild(new FPSMem(5, 5, 0xFFFFFF));
#end
}
}
7 changes: 5 additions & 2 deletions source/SavanLogo.hx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.util.FlxTimer;
import misc.FadeBoy;
import misc.Paths;
import states.MenuState;

Expand All @@ -26,6 +24,11 @@ class SavanLogo extends BaseState
logoText.y += 20;
add(logoText);

#if desktop
FlxG.mouse.visible = false;
FlxG.mouse.enabled = false;
#end

new FlxTimer().start(3, (_) -> FlxG.switchState(new MenuState()));
}
}
65 changes: 65 additions & 0 deletions source/misc/FPSMem.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package misc;

import haxe.Timer;
import openfl.display.FPS;
import openfl.events.Event;
import openfl.system.System;
import openfl.text.TextField;
import openfl.text.TextFormat;

/**

* FPS class extension to display memory usage.

* @author Kirill Poletaev

*/
class FPSMem extends TextField
{
private var times:Array<Float>;

private var memPeak:Float = 0;

public function new(inX:Float = 10.0, inY:Float = 10.0, inCol:Int = 0x000000)
{
super();

x = inX;

y = inY;

selectable = false;

defaultTextFormat = new TextFormat("_sans", 12, inCol);

text = "FPS: ";

times = [];

addEventListener(Event.ENTER_FRAME, onEnter);

width = 150;

height = 70;
}

private function onEnter(_)
{
var now = Timer.stamp();

times.push(now);

while (times[0] < now - 1)
times.shift();

var mem:Float = Math.round(System.totalMemory / 1024 / 1024 * 100) / 100;

if (mem > memPeak)
memPeak = mem;

if (visible)
{
text = "FPS: " + times.length + "\nMEM: " + mem + " MB\nMEM peak: " + memPeak + " MB";
}
}
}
22 changes: 22 additions & 0 deletions source/misc/Input.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package misc;

import flixel.FlxG;
#if mobile
import flixel.input.android.FlxAndroidKey;
#else
import flixel.input.keyboard.FlxKey;
#end

class Input
{
Expand All @@ -14,6 +18,7 @@ class Input
public static var SELECT:Bool;
public static var BACK:Bool;
public static var SHOOT:Bool;
public static var PAUSE:Bool;

// Controles alternos
public static var UP_ALT:Bool;
Expand All @@ -24,17 +29,31 @@ class Input
public static var SELECT_ALT:Bool;
public static var BACK_ALT:Bool;
public static var SHOOT_ALT:Bool;
public static var PAUSE_ALT:Bool;

// Detección de Gamepad
public static var isGamepadConnected:Bool;

public static function init()
{
#if mobile
FlxG.android.preventDefaultKeys = [FlxAndroidKey.BACK];
#else
FlxG.sound.volumeDownKeys = [NUMPADMINUS];
FlxG.sound.volumeUpKeys = [NUMPADPLUS];
FlxG.sound.muteKeys = [NUMPADZERO];
#end
trace("Input initialized!");
}

public static function update()
{
#if mobile
var firstTouch = FlxG.touches.getFirst();
SELECT = firstTouch != null ? firstTouch.justPressed : false;
PAUSE = FlxG.android.justPressed.BACK;
BACK = FlxG.android.justPressed.BACK;
#else
UP = FlxG.keys.justPressed.UP;
DOWN = FlxG.keys.justPressed.DOWN;
LEFT = FlxG.keys.pressed.LEFT;
Expand All @@ -43,6 +62,8 @@ class Input
SELECT = FlxG.keys.justPressed.ENTER;
BACK = FlxG.keys.justPressed.ESCAPE;
SHOOT = FlxG.keys.justPressed.Z;
PAUSE = FlxG.keys.justPressed.ENTER;
#end

#if desktop
// Solamente tengo un humilde joystick genérico, así que trataré mostrar lo mejor que pueda los controles.
Expand All @@ -59,6 +80,7 @@ class Input
SELECT_ALT = gamepad.justPressed.A;
BACK_ALT = gamepad.justPressed.BACK; // Xbox -> Back | Play -> Select
SHOOT_ALT = gamepad.justPressed.B;
PAUSE_ALT = gamepad.justPressed.START;
}
else
isGamepadConnected = false;
Expand Down
23 changes: 21 additions & 2 deletions source/misc/ScanLines.hx
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
package misc;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxSpriteGroup;
import flixel.util.FlxColor;
import openfl.display.BitmapData;
import openfl.geom.Matrix;
import openfl.geom.Rectangle;

// From HaxeFlixel examples xD
class ScanLines extends FlxSprite
class ScanLines extends FlxSpriteGroup
{
public function new(lines:Bool = true)
{
super();
var crtView = new FlxSprite();
crtView.loadGraphic(createCRTEffect(lines));
crtView.x = Game.GAME_X;
add(crtView);

var leftRect = new FlxSprite().makeGraphic(Game.GAME_X, Game.getGameHeight(), FlxColor.BLACK);
add(leftRect);

var rightRect = new FlxSprite(Game.GAME_X + Game.getGameWidth()).makeGraphic(Game.GAME_X, Game.getGameHeight(), FlxColor.BLACK);
add(rightRect);

var downRect = new FlxSprite(0, Game.getGameHeight()).makeGraphic(FlxG.width, Game.GAME_X, FlxColor.BLACK);
add(downRect);
}

function createCRTEffect(lines:Bool):BitmapData
{
var bitmapdata = new BitmapData(Game.getGameWidth(), Game.getGameHeight(), true, FlxColor.TRANSPARENT);
var scanline = new BitmapData(Game.getGameWidth(), 1, true, 0x40000000);

Expand Down Expand Up @@ -39,6 +58,6 @@ class ScanLines extends FlxSprite
bitmapdata.fillRect(new Rectangle(w - cX[i], h - cY[i], cX[i], cY[i]), FlxColor.BLACK);
}

loadGraphic(bitmapdata);
return bitmapdata;
}
}
Loading