Unexpected error when trying to add friction


  • Posts: 25
Hi, finally using Stencyl again after a long time... Anyway, I've made a simple platforming engine, just the horizontal(acceleration, friction) and vertical(jumping) movement for now.
It all works correctly, but when adding the friction(I have to make my own because the object takes forever to even slow down)I'll try to move the player it shows me this error:

Code: [Select]
[object AlchemyExit]
at Function/<anonymous>()
at Function/<anonymous>()
at Box2DAS.Dynamics::b2World/HandleStep()[/Users/jon/Desktop/stencyl/plaf/flash/Box2DAS/Box2DAS/Dynamics/b2World.as:185]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at Box2DAS.Common::b2EventDispatcher/dispatchEvent()[/Users/jon/Desktop/stencyl/plaf/flash/Box2DAS/Box2DAS/Common/b2EventDispatcher.as:27]
at Box2DAS.Dynamics::b2World/Step()[/Users/jon/Desktop/stencyl/plaf/flash/Box2DAS/Box2DAS/Dynamics/b2World.as:179]
at stencyl.api.engine::GameState/innerUpdate()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1475]
at stencyl.api.engine::GameState/postUpdate()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1395]
at stencyl.api.engine::GameState/update()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1377]
at org.flixel::FlxGame/update()[/Users/jon/Desktop/stencyl/plaf/flash/flixel/org/flixel/FlxGame.as:400]

Here's the code(using a code block in the every step wrapper):
Code: [Select]
//Horizontal movement
if (isKeyDown("left")){
if (actor.getXVelocity() > -maxXSpeed){actor.accelerateX(-xSpeed);};

if (isKeyDown("right")){
if (actor.getXVelocity() < maxXSpeed){actor.accelerateX(xSpeed);};

if (isKeyDown("jump")){
if (canJump == true){
canJump = false;

if (actor.getXVelocity() != 0){
if (actor.getXVelocity() > 0){actor.accelerateX(-friction);}else{actor.accelerateX(friction);};

Anyone know the problem? I've never done anything with AS3 before(nor any of the previous ones)so I'm not sure this is the best way to do this.

Any help is appreciated. Thanks in advance!
I've got a lovely bunch of coconuts.


  • *
  • Posts: 3130

I think you two have the same problem.
The problem was reported to the author of the port of Box2D we're using. I'm going to contact him again today, hoping for good news.

"Find the fun"


  • Posts: 25
So it isn't a problem with my code? =D

Hopefully it's fixed soon...

EDIT: It's working now.

« Last Edit: January 13, 2012, 02:50:06 pm by Emanrice »
I've got a lovely bunch of coconuts.