12.2 DRIBBLE
In this example we use the prebuilt function kickBall
. This function has input parameters const int kickTypeToUse
which indicate the type of kick to perform as well as a const VecPosition &target
which is the position you want to kick the ball to. To do this inside selectSkill()
we return the following statement:
return kickBall(KICK_DRIBBLE, VecPosition(HALF_FIELD_X, 0, 0)); // Dribble ball toward opponent's goal
As seen above we use kickBall
with KICK_DRIBBLE
as the kick type which is defined already within headers.h
. This is the kicktype which results in a dribble style behaviour. The second parameter which represents the target location was set as VecPosition(HALF_FIELD_X, 0, 0)
which is a VecPosition
initialised to represent the middle of the opponents goal. See the Field Positions page to see how layout works and what constants HALF_FIELD_X
and HALF_FIELD_Y
represent.