moved and changed Game.hx
This commit is contained in:
parent
6a3d97b45e
commit
b4f9559d19
@ -1,47 +0,0 @@
|
|||||||
import assets.tilesets.TilesetGeneric;
|
|
||||||
import openfl.display.Bitmap;
|
|
||||||
import openfl.display.Stage;
|
|
||||||
import openfl.display.Bitmap;
|
|
||||||
import openfl.display.BitmapData;
|
|
||||||
import openfl.display.Sprite;
|
|
||||||
import openfl.events.Event;
|
|
||||||
import openfl.Assets;
|
|
||||||
import assets.Scanner;
|
|
||||||
import assets.HTex;
|
|
||||||
|
|
||||||
|
|
||||||
class Game
|
|
||||||
{
|
|
||||||
public var stage:Stage;
|
|
||||||
public function new(_stage:Stage){
|
|
||||||
stage = _stage;
|
|
||||||
}
|
|
||||||
public var player:Sprite;
|
|
||||||
public function onInit():Void
|
|
||||||
{
|
|
||||||
player = new Sprite();
|
|
||||||
stage.addChild(player);
|
|
||||||
//player.graphics.lineStyle(2,0xFF0000);
|
|
||||||
//player.graphics.drawRect(0,0,16,16);
|
|
||||||
// var bitmapData:BitmapData = Assets.getBitmapData("textures/sprites/character.png");
|
|
||||||
Scanner.scanTextureDir();
|
|
||||||
var sheetData:BitmapData = Assets.getBitmapData("textures/sheets/sheet.png");
|
|
||||||
for(tex in Scanner.textures){
|
|
||||||
HTex.createTextureObjectFromJSON(tex);
|
|
||||||
}
|
|
||||||
//var sheet:SpriteSheet = new SpriteSheet(sheetData);
|
|
||||||
|
|
||||||
var playerBitmap:Bitmap = new Bitmap(TilesetGeneric.tilesetGenericMap["testsheet"].tileMap["testTile5"]);
|
|
||||||
var someotherbitmap:Bitmap = new Bitmap(TilesetGeneric.tilesetGenericMap["testsheet"].tileMap["testTile3"]);
|
|
||||||
|
|
||||||
playerBitmap.scaleX = playerBitmap.scaleY = 10;
|
|
||||||
player.addChild(playerBitmap);
|
|
||||||
//TextureData.parseConfig();
|
|
||||||
//Sys.
|
|
||||||
}
|
|
||||||
public function onEnterFrame(e:Event):Void
|
|
||||||
{
|
|
||||||
//player.x++;
|
|
||||||
//player.y++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
63
hGameTest/src/game/Game.hx
Normal file
63
hGameTest/src/game/Game.hx
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package game;
|
||||||
|
|
||||||
|
import game.entities.Player;
|
||||||
|
import assets.tilesets.TilesetGeneric;
|
||||||
|
import assets.tilesets.Tileset;
|
||||||
|
import openfl.display.Bitmap;
|
||||||
|
import openfl.display.Stage;
|
||||||
|
import openfl.display.Bitmap;
|
||||||
|
import openfl.display.BitmapData;
|
||||||
|
import openfl.display.Sprite;
|
||||||
|
import openfl.ui.Keyboard;
|
||||||
|
import openfl.events.Event;
|
||||||
|
import openfl.Assets;
|
||||||
|
import assets.Scanner;
|
||||||
|
import assets.HTex;
|
||||||
|
import openfl.Lib;
|
||||||
|
import openfl.display.StageDisplayState;
|
||||||
|
|
||||||
|
class Game
|
||||||
|
{
|
||||||
|
public var stage:Stage;
|
||||||
|
public function new(_stage:Stage){
|
||||||
|
stage = _stage;
|
||||||
|
Scanner.scanTextureDir();
|
||||||
|
for(tex in Scanner.textures){
|
||||||
|
HTex.createTextureObjectFromJSON(tex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public var player:Player;
|
||||||
|
public function onInit():Void
|
||||||
|
{
|
||||||
|
|
||||||
|
//player.graphics.lineStyle(2,0xFF0000);
|
||||||
|
//player.graphics.drawRect(0,0,16,16);
|
||||||
|
// var bitmapData:BitmapData = Assets.getBitmapData("textures/sprites/character.png");
|
||||||
|
player = new Player();
|
||||||
|
stage.addChild(player.sprite);
|
||||||
|
//var sheet:SpriteSheet = new SpriteSheet(sheetData);
|
||||||
|
//var playerBitmap:Bitmap = new Bitmap(Tileset.tilesetMap["testsheet"].tileMap["testTile5"]);
|
||||||
|
//var someotherbitmap:Bitmap = new Bitmap(Tileset.tilesetMap["testsheet"].tileMap["testTile3"]);
|
||||||
|
//playerBitmap.scaleX = playerBitmap.scaleY = 10;
|
||||||
|
//player.addChild(playerBitmap);
|
||||||
|
//TextureData.parseConfig();
|
||||||
|
//Sys.
|
||||||
|
}
|
||||||
|
public static var keys:Array<Bool> = [];
|
||||||
|
public static var keysLast:Array<Bool> = [];
|
||||||
|
public function onEnterFrame(e:Event):Void
|
||||||
|
{
|
||||||
|
trace(keys);
|
||||||
|
if( keys[Keyboard.ALTERNATE] && keys[Keyboard.ENTER] && !keysLast[Keyboard.ALTERNATE] && !keysLast[Keyboard.ENTER] ){
|
||||||
|
if(Lib.current.stage.displayState != StageDisplayState.FULL_SCREEN_INTERACTIVE){
|
||||||
|
Lib.current.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Lib.current.stage.displayState = StageDisplayState.NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keysLast = keys;
|
||||||
|
//player.x++;
|
||||||
|
//player.y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user