I’m making my first game, a 2d platform w/3d objects. How can I make my character switch directions and keep all of his logic and properties? Like I said, I am a beginner and don’t know a whole lot about it. Any help is appreciated.
i dont understand, all movement accelerations should be LOCAL, by default they prevail despite the direction or orientation of character.
I mean i want him to switch from facing right to facing left. He moves left and right. How do I make him switch directions when I press the key to go left or right?
Making your character change the direction he/she is facing does not have any effect on logic bricks or properties. The logic for what you want is(if you use python):
1 - If the right arrow key input is ‘logic.KX_INPUT_JUST_ACTIVATED’
2 - Set the localOrientation(not sure if it is world or local) of the character object to the desired value, using Euler values for obj.localOrientation X, Y and Z axis will make that less complicated I guess. You can also add to the current rotation instead of replacing the values; you could even always reset the character rotation to the default one before making any changes at this point. If you want logic bricks, at the motion actuator, The obj rotation is very next to the object location values.
Others can clarify/correct/improve what I said if needed.
If I did this with logic blocks I would first make some boolean properties to determine which way the character is currently facing and then use the properties to decide if the character should turn 180 or nothing at all.
Some ideas for logic only:
1: do an animation with two frames, one frame faces left, the other right. On a key press the animation skips to that frame
2: replace mesh, on a key press a left facing or right facing model is substituted
With Python you can set the local orientation of the object / character on a command.
Thanks, all of you I’ll try these to see what i can do