program game;
{$mode objfpc}
{$modeswitch externalclass}
uses
JS, Classes, SysUtils, Web;
type
TNotifyProcedure = procedure();
TPIXYLoader = class external name 'PIXI.loader'(TJSObject)
class function add(img: string): TPIXYLoader;
class procedure load(ev: TNotifyProcedure);
end;
TPIXYResources = class external name 'PIXI.loader.resources'(TJSObject)
end;
TPIXYSprite = class external name 'PIXI.Sprite'(TJSObject)
end;
TPIXYContainer = class external name 'PIXI.Container'(TJSObject)
Constructor new;
end;
TPIXYStage = class
public
procedure addChild(cont: TPIXYContainer); overload;
end;
TPIXYApplication = class external name 'PIXI.Application'(TJSObject)
private
FStage: TPIXYStage external name 'stage';
FView: TJSNode external name 'view';
public
constructor new(args: TJSObject);
property view: TJSNode read FView;
property stage: TPIXYStage read FStage;
end;
var
app: TPIXYApplication;
left, up, right, down: TJSObject;
procedure setup();
var
map1: TJSArray;
ganador: boolean;
container: TPIXYContainer;
begin
container := TPIXYContainer.new;
app.stage.addChild(container);
ganador := False;
map1 := TJSArray.new(
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 1, 0, 0, 0, 0, 0, 1,
1, 0, 0, 1, 0, 0, 0, 0, 0, 1,
1, 0, 0, 1, 0, 0, 0, 0, 0, 1,
1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 2, 1, 0, 0, 1,
1, 0, 0, 1, 1, 1, 1, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
);
end;
procedure TPIXYStage.addChild(cont: TPIXYContainer);
begin
end;
begin
app := TPIXYApplication.New(new(['width',320,'height',342,'antialias',true,'transparent',false,'resolution',1]));
document.body.appendChild(app.view);
TPIXYLoader.add('images/block1.png');
TPIXYLoader.add('images/block0.png');
TPIXYLoader.add('images/block2.png');
TPIXYLoader.add('images/player.png');
TPIXYLoader.add('images/enemy.png');
TPIXYLoader.add('images/enemyending.png');
TPIXYLoader.load(@setup);
end.