This site requires JavaScript, please enable it in your browser!
Greenfoot back
Score78
Score78 wrote ...

2021/2/8

does anybody know what this code does?

Score78 Score78

2021/2/8

#
double angle = Math.toRadians( getRotation() ); int x = (int) Math.round(getX() + Math.cos(angle) * Speed); int y = (int) Math.round(getY() + Math.sin(angle) * Speed); Im knew to Greenfoot and still dont know some Mechanics
danpost danpost

2021/2/8

#
Score78 wrote...
does anybody know what this code does?]t4]
double angle = Math.toRadians( getRotation() );
int x = (int) Math.round(getX() + Math.cos(angle) * Speed);
int y = (int) Math.round(getY() + Math.sin(angle) * Speed);
It is "supposed" to make an actor move more precisely; but fails, as accuracy is lost by the roundings.
You need to login to post a reply.