Item 1 of 1 Previous | Next

0
Vote

refactoring metody iscollision

description

metodu Actor.IsCollision dat na Area.IsCollision
a zbavit se tech dvou helpermetod realposition

No files are attached

comments

Kikaimaru wrote Feb 5 2011 at 4:08 PM

a taky smaz ty for cykly, a ta metoda by mela vypadat nejspis takhle


Area.IsCollision(Rectangle test)

a v Actor.Update

udelat neco jako
var testRectangle = new (Position.X + movement.X, Position.Y)
if (Area.IsCollision(testRectangle))
movement.X = 0;

this.Position += movement;

if (movement == Vector2.Zero)
State = Idle