Using haxelib (with nape)


I’m trying to use a haxelib (nape) and I’ve done this

  1. Set up a blank project openfl project NapeSample.
  2. Copy an example this one.
  3. Install nape via haxelib install nape.

So far so good, but when I try to test this with openfl test flash I get:

Source/Main.hx:17: characters 7-33 : Class not found : nape.constraint.AngleJoint

It looks like it just can’t find the nape classes. How do I actually use the haxelib once it’s installed.

Try opening the “project.xml” file, you should see something like this:

<haxelib name="openfl" />

You’ll want to add another one for nape, like this:

<haxelib name="nape" />


I just saw that. Is there a way to manage that with the command line or should I edit that file directly?

Next up I’m getting this error:

Warning: Could not find template file: haxe Warning: Could not find template file: flash/hxml

I’ll google around and see what I get. :smile:

Er, nm. I somehow ended up in the wrong directory.

I wonder if a different error could be written that would reveal such a silly mistake (such as no project.xml found in current directory or something like that if you run openfl test or openfl build from a non-openfl project directory, just to toss around random ideas.

One more:
I got the Nape example to build for flash, but it doesn’t seem to work for HTML5 or mac. I get a variant of the same set of errors:

Source/Template.hx:60: characters 21-45 : Class<openfl.system.System> has no field totalMemoryNumber Source/Template.hx:167: characters 12-49 : Class<openfl.system.System> has no field pauseForGCIfCollectionImminent Source/Template.hx:107: characters 20-85 : Class not found : BitmapDebug Source/Template.hx:224: characters 35-59 : Class<openfl.system.System> has no field totalMemoryNumber

Commenting out the System.* errors clears those up - now I just have to find the missing nape.util.BitmapDebug class

Update on BitmapDebug:

It looks like BitmapDebug is a Nape class that uses the Alchemy opcodes. Is that why it doesn’t work on mac and html5 targets?

I guess I’ll start looking at Box2D.


Kevin N.

Try ShapeDebug instead of BitmapDebug

It worked! There was actually a param for that. I still had to comment out BitmapDebug though, since it couldn’t find the class (it’s behind a flash10 ifdef in the Nape source).