zaterdag 6 februari 2016

Stencyl : Reading properties from a text file into a Map



The file posted on the website has this text:

MapEntry1=Value1
Property2=Value2

Disclaimer: This will fail when there is a = sign in the map-key!


Haxe / Stencyl : Drawing shapes onto image

Haxe / Stencyl

Drawing stuff like lines, shapes, circles, rectangle on an image:

var shape = new nme.display.Shape();
var g = shape.graphics;
g.beginFill( 0xffffff );
g.lineStyle(1,0x000000);

g.drawRect(8,8,280,280);
g.moveTo(32,32);
g.lineTo(128,128);
g.endFill();
var bmp = new BitmapData(64,64,true, 0x00000000 );
bmp.draw(shape);
var b=new Bitmap(bmp);

attachImageToHUD(new BitmapWrapper(b), 0,0);

or:

bd = new BitmapData(Std.int(shapeWidth), Std.int(shapeHeight), true, 0);
var s = new Shape();
s.graphics.lineStyle(2, 204);
s.graphics.drawCircle(50, 50, 20);
bd.draw(s);
attachImageToHUD(new BitmapWrapper(new Bitmap(bd)), 0, 0);

donderdag 4 februari 2016

Stencyl / Extensions : avoid recompilation of whole project

When you have an Haxe Extension and you use some kind of java you needed to clean the Stencyl project when you changed some Java Code.

This little trick will not re-compile the complete project:

rm -rf ../games-generated/YourGame/Export/android/bin/deps/YourExtension