error: int should be flixel.math.FlxPoint

99 views
Skip to first unread message

baxter

unread,
Feb 18, 2016, 2:04:42 PM2/18/16
to HaxeFlixel
Hi guys, i'm new to haxeflixel and im doing the tutorial, but when i compile the prompt say me this: int should be flixel.math.FlxPoint on line 91

package;

import flixel.FlxSprite;
import flixel.system.FlxAssets.FlxTilemapGraphicAsset;
import flixel.util.FlxColor;
import flixel.FlxG;
import flixel.math.FlxPoint;
import flixel.FlxObject;

class Player extends FlxSprite
{

public var speed:Float = 200;

public function new(X:Float=0,Y:Float=0)
{
super(X,Y);
loadGraphic(AssetPaths.player__png,true,16,16);
setFacingFlip(FlxObject.LEFT,false,false);
setFacingFlip(FlxObject.RIGHT,true,false);
animation.add('lr',[3,4,3,5],6,false);
animation.add('u',[6,7,6,8],6,false);
animation.add('d',[0,1,0,2],6,false);
drag.x = drag.y = 1600;
}

override public function update(elapsed:Float):Void
{
//movement();
super.update(elapsed);
}

override public function destroy():Void
{
super.destroy();
}

private function movement():Void
{
var up:Bool = false;
var down:Bool = false;
var left:Bool = false;
var right:Bool = false;

up = FlxG.keys.anyPressed([UP,W]);
down = FlxG.keys.anyPressed([DOWN,S]);
left = FlxG.keys.anyPressed([LEFT,A]);
right = FlxG.keys.anyPressed([RIGHT,D]);

if(up && down)
up = down = false;

if(left && right)
left = right = false;

if(up || down || left || right)
{
var mA:Float = 0;
if(up)
{
mA = -90;
if(left)
mA -= 45;
else if(right)
mA += 45;
facing = FlxObject.UP;
}
else if(down)
{
mA = 90;
if(left)
mA += 45;
if(right)
mA -= 45;
facing = FlxObject.DOWN;
}
else if(left)
{
mA = 180;
facing = FlxObject.LEFT;
}
else if(right)
{
mA = 0;
facing = FlxObject.RIGHT;
}
velocity.set(speed,0);
velocity.rotate(FlxPoint.weak(0,0),mA);

if((velocity != 0 || velocity.y != 0) && touching == FlxObject.NONE)
{
switch(facing)
{
case FlxObject.LEFT, FlxObject.RIGHT:
animation.play('lr');
case FlxObject.UP:
animation.play('u');
case FlxObject.DOWN:
animation.play('d');
}
}

}

}


}

above the script, help me please.
thank you!

baxter

unread,
Feb 18, 2016, 2:32:43 PM2/18/16
to HaxeFlixel
I have found the errors..

here:

velocity.set(speed,0);
                 velocity.rotate(FlxPoint.weak(0,0),mA);

change to

velocity.set(speed,0);
                 velocity.rotate(new FlxPoint.weak(0,0),mA);

and here


if((velocity != 0 || velocity.y != 0) && touching == FlxObject.NONE)
{
switch(facing)
{
case FlxObject.LEFT, FlxObject.RIGHT:
animation.play('lr');
case FlxObject.UP:
animation.play('u');
case FlxObject.DOWN:
animation.play('d');
}
}

change to


if((velocity.x != 0 || velocity.y != 0) && touching == FlxObject.NONE)
Reply all
Reply to author
Forward
0 new messages