So I'm trying to create a "homing projectile" that follows the block a player is targeting and eventually explodes. The problem I'm facing is that I need a new direction for the code below. Right now it uses the direction the player is looking at, but I want the projectile to go where the player is aiming at (targeted block) from the location where it is at that moment ({_loc}). Does anyone have a clue how to do this? I can't find anything. Thanks!
P.S. How do I properly use the code tag on the new forums?
Code:
set {_player} to player
set {_loc} to location of player
loop 300 times:
set {_loc} to location 0.3 meter in direction of player from location of {_loc}
show 1 cloud particle at {_loc} offset by 0, 0, 0 at speed 0.01
#On collision with block
if block at {_loc} isn't air or tall grass or fern or water:
#Explode
exit 2 sections
wait 1 tick
P.S. How do I properly use the code tag on the new forums?