Write the methods shootTargetMissile and moveTargetMissile. You should figure ou
ID: 3694789 • Letter: W
Question
Write the methods shootTargetMissile and moveTargetMissile. You should figure out appropriate parameters for these and call these in the main loop.
The method shootTargetMissile should shoot a missile with probability TARGET_SHOOT_PROBABILITY if the missile is not active. It should do nothing if the target missile is already active. When shooting a missile, set targetMissileActive to true, set the position of the missile to the position of the center of the target, and for now, just shoot the missile straight down: the deltaY value is TARGET_SIZE/2 and the deltaX value is 0.
The method moveTargetMissile should do nothing if the missile is not active. If it is, it should move the missile appropriately, callingdrawTargetMissile where necessary. Look at the moveMissile method as a guide, The missile should bounce off the side walls, but should become inactive if it moves past the bottom of the screen. This missile only moves down, so you do not have to check for it hitting the top of the screen.
Explanation / Answer
shootTargetMissile()
{
string Target_shoot_probability,targetMissileActive,,s1;
boll arr[2]={true,false};
s1='Active';
float target_size,deltay,deltax;
if(Target_shoot_probability!=s1)
printf("shoot");
else
printf("do nothing");
printf("enter size of target:")
scanf("%f",&target_size);
if(targetMissileActive==array[1])
{
deltay=target_size/2;
deltax=0
printf("%f",deltay);
printf("now shoot");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.