# Gamemaker - Change the fired bullets' direction using objects as guide

So I am trying to create a shooting-ship-puzzle game at sea on gamemaker. There is a playership that must shoot the enemy ships using only the available "whirlpools". There are many whirlpools in the sea, but there is only one path consisting of whirlpools that will lead the bullets to the enemy ships and destroy them. There are different types of whirlpools, one that can direct the bullets using 90 degrees angle, U-turn whirlpool, etc. But my problem is how to change the direction of the fired bullets using those whirlpools. So can you guys maybe help me out with this problem...?

Thanks,

• I don't believe the bullet-physics tag was interpreted correctly. Questions use the tag if they pertain to the use of the bullet physics library, not the physics of bullets. :) – newton1212 Jun 14 '15 at 11:14

Add a static variable stored in each whirlpool that declares the angle to turn:

public static float turningAngle = 90.0f;


*Commonly, positive values for turning right, negative values for turning left.

When the bullet enters the trigger bound with the whirlpool, the bullet takes the turningAngle's value and rotates itself by that angle.

// Rotate(x, y, z, w) <-- A Quaternion's rotate function
this.Rotate(0, turningAngle, 0, 0);


Make sure the bullet is travelling at the positive direction of x-axis or z-axis, or else you may have to modify the axis and angle.