Rotate the Actor, Not his Orientation
RacetotheMoon
Member Posts: 323
I'm wondering if there is anyway possible to visually rotate an actor, but to always keep his orientation the same?
When I give my actor the command to jump I want to see him rotate in the air 90, 180, or 270 degrees, which I've been able to do thus far. However, if he hits the ground with one of those rotations, and then tries to jump again, he'll attempt to do so at the angle that's relative to the position he started the scene, and not his new orientation.
So now, when my actor jumps and falls on his side (90 degrees) he now think the standard x 0 position, or right, is the direction he should be jumping. This certainly makes sense, but if possible I'd like to find a way around it.
So far I've tried all three rotate behaviors (Rotate, Rotate to Angle, Rotate to Position). Rotate is obviously the easiest to use, but has least amount of features.. the other two I've been able to use to a varying degree.. in fact, I thought perhaps the 'relative to' actor/scene switch would have been my cure all.. but no such luck.
Any help would be very much appreciated.
When I give my actor the command to jump I want to see him rotate in the air 90, 180, or 270 degrees, which I've been able to do thus far. However, if he hits the ground with one of those rotations, and then tries to jump again, he'll attempt to do so at the angle that's relative to the position he started the scene, and not his new orientation.
So now, when my actor jumps and falls on his side (90 degrees) he now think the standard x 0 position, or right, is the direction he should be jumping. This certainly makes sense, but if possible I'd like to find a way around it.
So far I've tried all three rotate behaviors (Rotate, Rotate to Angle, Rotate to Position). Rotate is obviously the easiest to use, but has least amount of features.. the other two I've been able to use to a varying degree.. in fact, I thought perhaps the 'relative to' actor/scene switch would have been my cure all.. but no such luck.
Any help would be very much appreciated.
Comments
If you use rotation, you need to bring it back down to original rotation/orientation to have a repeat jump in the correct direction or you will get the results you see.
You could have an invisible actor that handles the jumping appropriately, always coming back down with the proper rotation/orientation and then constrain a visible actor's X/Y position to the invisible's X/Y position and then you would be free to rotate the visible actor as you see fit.
I cannot really think of why you are trying to do what you are doing unless your actor is some funky ball/blob/star or something. What is the actor in question?
The object in question is just a box right now, but I was thinking it'd be a ball, or something else, I'm just going through the paces right now and trying to figure this engine out. It's fun to mess around with.
Couple small notes:
Since I have both actors visible until I lock the control down I've been able to see, much like my color blending code from the night before, there is some inaccuracy in the numbers Game Salad processes. While moving the visible character lags by a noticeable (eight pixels, or so) gap. It's not going to matter so much for the end result here, but this would obviously be a concern of mine if I were the develop team working on the engine, moving forward.
I'm also running into an issue where sometimes (about 1 in 6) the visible square doesn't return to a position that's flat on the ground. It's turned ever so slightly. I think I might know how to fix this tho.
I tried to implement them once but some how broke things.. I was going to go back and try again once I had a little more knowledge.
Steps:
1) Create 3 game attributes-
game.playerX (integer or real)
game.playerY (integer or real)
game.jumpingUp (boolean)
2) Create a square actor with a fixed rotation that will eventually be invisible. Put your jumping and right / left rules in this. This will give you a more consistent jump due to the fixed rotation. Constrain game.playerX to self.position.X and game.playerY to self.position.Y. Keep it visible during testing, then uncheck the visibility checkbox before release. Have a rule that says when self.linearmotion.Y is > 0 change attribute game.jumpingUp to true, otherwise false.
3) Create an actor with the player's image.
-Constrain self.position.X to game.playerX and self.position.Y to game.playerY
RULE
when game.jumpingUp is true
Rotate (play with settings until it looks right to you)
OTHERWISE (here's the key part)
Rotate to angle 0
So the image will rotate and at the peak of the jump will rotate to 0 degrees and will stop and fall without spinning until it jumps again in which it will spin again.
I feel like I may be giving away the key gimmic in my current game, but the helll! Enjoy!
Maybe those who use this will DL a ten speed taxi song from iTunes! ;-}