EDIT: This question has been put aside by creator. It is CLOSED
I have an object effect question.
I want a lifebar, basically. It works in all cases EXCEPT for cases where SetMovePosition is used. GetAngle for the incorrect render is -172 degrees. For graphics in DrawLoop, I use (GetAngle+360)%360 to control the images.
I used the exact same strategy for the lifebar, but it seems that it refuses to work the way it should (the other enemies going at 188 degrees have correct lifebars).
Is this a problem with when tasks are executed in relation to @MainLoop, or is the problem with me?
Normal DrawLoop Code (which works) SetGraphicRect(19, 17, 41, 41); //Down. Default
if((GetAngle+360)%360>315||(GetAngle+360)%360<=45){SetGraphicRect(64, 16, 82, 42);} //Rt
if((GetAngle+720)%360>135&&(GetAngle+720)%360<=225){SetGraphicRect(84, 16, 102, 42);}//Left
if((GetAngle+360)%360>225&&(GetAngle+360)%360<=315){SetGraphicRect(40, 16, 61, 44);}//Up
The Lifebar task code, which works when SetMovePosition02 is not used but fouls up when it is used. if((GetAngle+360)%360>135&&(GetAngle+360)%360<=225){
ObjEffect_SetVertexXY(life,0,(-dimensions[0]-7)*(GetLife/startHP),-3);
ObjEffect_SetVertexXY(life,1,(dimensions[1]-7)*(GetLife/startHP),-3);
ObjEffect_SetVertexXY(life,2,(dimensions[1]-7)*(GetLife/startHP),3);
ObjEffect_SetVertexXY(life,3,(-dimensions[0]-7)*(GetLife/startHP),3);
}
I already tried substituting +720 degrees instead of +360, and that made no difference.
Edit:
OK. I am using graphics for enemies that are controlled by the stuff in the first box of code. This normalized stuff is what sets the enemy graphics.
I want a lifebar that is centered above the enemies that decreases from both sides as the enemy's health is depleted. That pat is done. However, I have problems trying to center it above the enemy graphics, since using SetMovePosition02, for some inexplicable reason, does not give the same lifebar position. It is either a problem with my code, or something more fundamental with Danmakufu. Worse case scenario, I replace my SetMovePosition02s wit SetSpeed and SetAngle so that I can actually control the stuff.
Currently, the left moving graphic when using SetMovePosition 02 results in a lifebar that is 6 pixels to the left of where it is supposed to be. The problem does not occur with SetAngle.
Using GetAngle on the enemy provided an angle of -172. When normalized with my formula, it should be the same as if I had used SetAngle(188). But it isn't. That's the problem.
EDIT: This question has been put aside by creator. It is CLOSED
@Ozzy: Thanks for all of the attempts to try and fix this, but I think it looks reasonably acceptable now. I'm content with where it is, although some of the lifebars are assymetrical in regards to enemy graphics.