ArcaneMX
04-12-2005, 11:40 PM
Hello everyone,
I am developing an RPG style game, and so far, I'm just working on the movement of the charecter (called "char").
I have a movie clip of an object, here is what it needs to do;
if (Key.isDown(UP)) {
rotate on it's registration point to the position facing up
if (Key.isDown(DOWN)) {
rotate on it's registration point to the position facing down
if (Key.isDown(LEFT)) {
rotate on it's registration point to the position facing left
if (Key.isDown(RIGHT)) {
rotate on it's registration point to the position facing right
It must rotate from where it currently is (ex. It is facing left, you press right, and it turns 180 degrees)(ex. It is facing left, you press up, and it turns 90 degrees).
The best I can come up with is this;
if (Key.isDown(UP) && if (it is currently facing down)) {
_rotation +=(given ammount until it reaches 180);
if (Key.isDown(UP) && if (it is currently facing right)) {
_rotation +=(given ammount until it reaches -90)
if (Key.isDown(UP) && if (it is currently facing left)) {
_rotation +=(given ammount until it reaches 90);
if (Key.isDown(UP) && if (it is currently facing up)) {
_rotation = 0
And repeat this, changin the situation for down, left and right.
I simply can't find the right way to word it, so any suggestions or help would be appreciated. Thank you,
I am developing an RPG style game, and so far, I'm just working on the movement of the charecter (called "char").
I have a movie clip of an object, here is what it needs to do;
if (Key.isDown(UP)) {
rotate on it's registration point to the position facing up
if (Key.isDown(DOWN)) {
rotate on it's registration point to the position facing down
if (Key.isDown(LEFT)) {
rotate on it's registration point to the position facing left
if (Key.isDown(RIGHT)) {
rotate on it's registration point to the position facing right
It must rotate from where it currently is (ex. It is facing left, you press right, and it turns 180 degrees)(ex. It is facing left, you press up, and it turns 90 degrees).
The best I can come up with is this;
if (Key.isDown(UP) && if (it is currently facing down)) {
_rotation +=(given ammount until it reaches 180);
if (Key.isDown(UP) && if (it is currently facing right)) {
_rotation +=(given ammount until it reaches -90)
if (Key.isDown(UP) && if (it is currently facing left)) {
_rotation +=(given ammount until it reaches 90);
if (Key.isDown(UP) && if (it is currently facing up)) {
_rotation = 0
And repeat this, changin the situation for down, left and right.
I simply can't find the right way to word it, so any suggestions or help would be appreciated. Thank you,