トピック
PChicken NerdChicken

How do you point a sprite at something?

I need the formula, to make my game look nice.
3そうだね
プレイ済み
返信[1]
親投稿
DasEtwas MyTheo00
If you for example have an arrow sprite, you can point it in a direction with SPANG or something like that. For the angle formula, you first need the X and Y distance to the object. DX = objectX - spriteX DY = objectY - spriteY then we can use the formula to get the angle in radians RADANG = ATAN2(DX, DY) now we just have to convert it to degrees DEGANG = DEG(RADANG)
0そうだね
未プレイ
返信[2]
親投稿
DasEtwas MyTheo00
sorry it's DX = spriteX - objectX same for DY assuming "sprite" is the arrow in this case
0そうだね
未プレイ
返信[3]
親投稿
PChicken NerdChicken
thx
1そうだね
プレイ済み