Summoning based on direction player is facing

I'm trying to create a jetpack with the new elytra by summoning in exploding creepers behind you to boost you, but I can only do it in one direction. I'm using this command:

/execute @e[type=Player,name=CheeseTruffles] ~-4 ~ ~ summon Creeper ~ ~ ~ {Fuse:0}

But it only hits you in one spot. Is there anyway to make the summoning location depend on the place you're looking?


Solution 1:

Yes, this is possible. You can use the ry and rym selector tags. ry is the maximum horizontal rotation, rym is the minimum. From Gamepedia:

Horizontal rotation values vary from -180.0 (facing due north), to -90.0 (facing due east), to 0.0 (facing due south), to 90.0 (facing due west), to 179.9 (just west of due north) before wrapping back to -180.0 (thus horizontal rotation values increase with rotation to the right, or clockwise viewed from above).

Just include the selector tags in your selector. More info