How would I configure my projectile object so that when it is fired via verb the object is aligned with its user? With pixel movement sometimes I find the projectile at the users head or feet. Other times it's right in the middle where I want it.
|
I'm mobile at the moment, but like Wissam said, it's a simple "guess-and-check" process. Something along the lines of:
projectile.step_y = (y_offset > 0) ? owner.step_y + y_offset : owner.step_y - y_offset |
Usually, you only need to set the step_x and _y variables equal between the projectile and shooter.
|
Altering both the step_x and step_y of the projectile isn't changing anything. Any tips?
|
You don't need to check whether the offset is greater than 0 or not. Adding a negative number is subtraction.
|
projectile.step_y = owner.step_y + y_offset Maybe I'm just not understanding what your goal is, but this is only part of the code. That y_offset will be calculated by the starting direction of the projectile :) The ternary thing doesn't seem to explain that, it seems like bad math (if you wanted to use absolute values, you can just use abs()) |
EDIT: Actually, you'd adjust its step_x and/or step_y.