hey how can i do this for a 2d platformer
import GameLogic
cont = GameLogic.getCurrentController()
own = cont.getOwner()
own.setPosition([own.getPosition()[0], 0.000, own.getPosition()[2]])
Also, select player and use CTRL+A.
import GameLogic
cont = GameLogic.getCurrentController()
own = cont.getOwner()own.setPosition([own.getPosition()[0], 0.000, own.getPosition()[2]])
If you’re going to run that every frame then use this:
own = GameLogic.getCurrentController.owner
own.position = [own.position[0], 0.000, own.position[2]]
That’s using the new python API, lol. The simple way would be to use the constraint actuator (and the most efficient)
ok thanks o lot man you rock
No problem, anytime m8 =)
Like -[Killer]- said, link up the logic [Sensor: Always]-----[AND]-----[Constraint]
For the constraint, set the Limit to Y and set the Min and Max both to the coordinates of where you want the player to be. You can press N to open transform properties and Copy the Y coordinates and Paste them into the Min/Max buttons on the constraint actuator.
This question is kinda vague.
how so? it a simple question right
No vague at all, how to keep player on x and y, what would you of said? How do I keep the player on x and y axis? Or How to keep my player on the x and y axis but not the z?
Not that tough of a question kid =)