|
Viewing 1 to (11 Total) |
|
Hi,
I am porting this great flocking algorithm (http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors) to Haxe and I am facing some problems.
It compiles fine for flash, but for CPP, I have those errors :
Source/boid/Boid.hx:530: characters 12-27 : nme.geom.Matrix3D has no field pointAt
Source/boid/Boid.hx:535: characters 8-38 : neash.geom.Transform has no field matrix3D
Source/boid/Boid.hx:1183: characters 16-43 : nme.display.DisplayObject has no field local3DToGlobal
Source/boid/Boid.hx:582: characters 16-55 : neash.geom.Transform has no field matrix3D
Source/boid/Boid.hx:583: characters 30-57 : nme.display.DisplayObject has no field globalToLocal3D
Source/boid/Boid.hx:602: characters 16-55 : neash.geom.Transform has no field matrix3D
Source/boid/Boid.hx:603: characters 30-57 : nme.display.DisplayObject has no field globalToLocal3D
Source/boid/Boid.hx:623: characters 16-55 : neash.geom.Transform has no field matrix3D
Source/boid/Boid.hx:624: characters 30-57 : nme.display.DisplayObject has no field globalToLocal3D
Source/boid/Boid.hx:643: characters 16-55 : neash.geom.Transform has no field matrix3D
Source/boid/Boid.hx:644: characters 30-57 : nme.display.DisplayObject has no field globalToLocal3D
Is this normal, or another way in CPP to do what I want ?
Thanks a lot 
Posted on June 01, 2012 at 5:47 PM
|
|
Does the sprite moves a little ?
body.getUserData() returns the body position in meters, but not in pixels, to you have to multiply this value to get your sprite moving on your stage.
For example if your PHYSICS_SCALE is 1 / 30, you will have to multiply body.getPosition() by 30 to get your sprite follow its debug sprite.
In your case :
player.body.getUserData().x = player.body.getPosition().x *METERS_TO_PIXELS; // meters to pixels equals 30
player.body.getUserData().y = player.body.getPosition().y *METERS_TO_PIXELS;
Posted on May 28, 2012 at 9:46 AM
|
|
Hi, yep, it's not updating the drawing when the box2d physic object move.
You first have to attach your sprite ( that can be your graphics.drawCircle ) to the b2body object, when you create it, with the setUserData method :
body.setUserData(yourSprite);
and then, you have to update the sprite position in the box2d loop.
What I do is to push all my bodies in an Array, and so I can acces to them everywhere.
So you will have in your box2d loop something like :
//b2BodyElements is my array of bodies
for (myBody in b2BodyElements)
{
//If the body has an attached Sprite
if(myBody.getUserData() != null && Std.is(cast(myBody.getUserData(), Sprite), Sprite))
{
//Sets the x, y, and rotation of the sprite
generalBody.getUserData().x = generalBody.getPosition().x ;
generalBody.getUserData().y = generalBody.getPosition().y ;
generalBody.getUserData().rotation = generalBody.getAngle();
}
}
This is a simple render loop for box2d.
When I started box2d for haxe I followed tutorials on those websites :
http://blog.allanbishop.com/
http://www.emanueleferonato.com/...
(be careful, sometimes they are not for 2.1a version and there are little differences )
Posted on May 27, 2012 at 2:56 PM
|
|
Also, when I want to apply a soundTransform with a pan depending on the position of an object on the scene, It seems not to work for CPP and ios target.
It works for flash.
Here is the code :
var sound:Sound = Assets.getSound("mySfx.mp3");
var soundChannel:SoundChannel = sound.play();
var newTransform:SoundTransform = soundChannel.soundTransform;
newTransform.pan = ( xPan / Lib.current.stage.stageWidth) * 2 - 1; //xPan is the xvalue of my object in the scene. I obtain a Float value between -1 and 1.
soundChannel.soundTransform = newTransform;
Posted on April 30, 2012 at 3:31 AM
|
|
ok, here is the sound :http://dl.dropbox.com/u/19785236/haxe/rock1.wav...
and another test sound I tried and failed too :http://dl.dropbox.com/u/19785236/haxe/writing.wav...
thanks a lot 
Posted on April 29, 2012 at 11:45 AM
|
|
With some research it seems like flash doesn't like wav format, so i made this in the .nmml file :
< assets path="Assets/audio/sounds" rename="sounds" type="sound" include="*.wav" unless="flash"/ >
< assets path="Assets/audio/soundsflash" rename="sounds" type="sound" include="*.mp3" if="flash" / >
and it works.
Am I right about the wav format on flash ?
Posted on April 29, 2012 at 11:02 AM
|
|
Hello, I have a strange problem with wav sound.
I have a sounds folder with my sound , and it is referenced like this in the .nmml file :
< assets path="Assets/audio/sounds" rename="sounds" type="sound" include="*.wav" / >
So I want to use sounds but not music type.
I have this error when I compile to flash :
Called from ? line 1
Called from InstallTool.hx line 636
Called from a C function
Called from InstallTool.hx line 111
Called from a C function
Called from installers/InstallerBase.hx line 191
Called from installers/FlashInstaller.hx line 55
Called from installers/FlashInstaller.hx line 281
Called from format/wav/Reader.hx line 91
Uncaught exception - expected data subchunk
My sounds play well for cpp target.
Is there a special format encoding for wav files for flash ?
Thanks
Posted on April 29, 2012 at 8:58 AM
|
|
Hello,
I would like to set a starting frame to my animated spritesheet.
I have followed this tutorial :http://www.joshuagranick.com/blog/?p=493... .
But when I add many instances of the same spritesheet, they all play together.
What I want is to set the number of the starting frame, so that all my spritesheet doesn't play at the same image at the same time.
I've seen that there is a currentFrameIndex inhttp://lib.haxe.org/d/spritesheet/1.05/com/eclecticdesignstudio/spr... but I can't manage to make it work...
Thanks !
Posted on February 02, 2012 at 9:27 AM
|
|
Ok thanks ! I think I'll wait the next release.
Posted on December 06, 2011 at 3:23 AM
|
|
Hello,
I have a problem to make custom font (.ttf) working on ios. When I compile the TextFields tutorial, I only have a white background on my iPad, and the text doesn't shows.
It runs well with flash target, but I need my application to run on ios devices.
Is there another way on making embeded font work on iOS , or do I have missed something ?
Posted on December 04, 2011 at 2:42 PM
|
|
Hello,
I think I've searched a lot, but I can't manage to create a new haxe project in FDT, so that I can compile for iOS with the command line
haxelib run nme update "[File].nmml" ios
The problem is that I can't see any .nmml file, like the Actuate Example has, to be able to compile...
What is the way to do that ?
Thanks !
Posted on November 19, 2011 at 3:23 AM
|