Thomas8472
05-04-2009, 08:49 AM
It seems I'm doing everything right, but when I collide I get stuck and can't move. Anyone having similar problems?
update:
rotate(dRot);
var cx=Math.cos(rotation*(Math.PI/180))*speed;
var cy=Math.sin(rotation*(Math.PI/180))*speed; //how to move
px=x; //previous coordinates
py=y;
x-=cx; //change coordinates
y-=cy;
Hsp.fieldCont.x=x-ox; //move state fields. don't mind this.
Hsp.fieldCont.y=y-oy;
hx=-(x-ox); //move map
hy=-(y-oy);
Hsp.inst.transform.matrix=new Matrix(1,0,0,1,hx,hy);
handleCollision:
x=px;
y=py;
Hsp.fieldCont.x=px-ox;
Hsp.fieldCont.y=py-oy;
hx=-(px-ox);
hy=-(py-oy);
Hsp.inst.transform.matrix=new Matrix(1,0,0,1,hx,hy);
rotate(-dRot);
update:
rotate(dRot);
var cx=Math.cos(rotation*(Math.PI/180))*speed;
var cy=Math.sin(rotation*(Math.PI/180))*speed; //how to move
px=x; //previous coordinates
py=y;
x-=cx; //change coordinates
y-=cy;
Hsp.fieldCont.x=x-ox; //move state fields. don't mind this.
Hsp.fieldCont.y=y-oy;
hx=-(x-ox); //move map
hy=-(y-oy);
Hsp.inst.transform.matrix=new Matrix(1,0,0,1,hx,hy);
handleCollision:
x=px;
y=py;
Hsp.fieldCont.x=px-ox;
Hsp.fieldCont.y=py-oy;
hx=-(px-ox);
hy=-(py-oy);
Hsp.inst.transform.matrix=new Matrix(1,0,0,1,hx,hy);
rotate(-dRot);