Car game problem
panicq
Member Posts: 27
Hello im panicq.
Im ready to start a car game (i have finished the graph) and i want just resolve a pb: I have test the car game sample but into this game there is one bug we cant change the direction when we move up the car.
For ex: I press the UP key and if I want change the direction I turn with the RIGHT key but the direction doesnt change. The angle change but not the direction.
Thanks
And escuse me for my english, Im french.
Bey
Im ready to start a car game (i have finished the graph) and i want just resolve a pb: I have test the car game sample but into this game there is one bug we cant change the direction when we move up the car.
For ex: I press the UP key and if I want change the direction I turn with the RIGHT key but the direction doesnt change. The angle change but not the direction.
Thanks
And escuse me for my english, Im french.
Bey
Comments
If pressing "R" then change attribute self.rotation to self.rotation - 5
If pressing "L" then change attribute self.rotation to self.rotation + 5
You would probably want to put the "5" in a game attribute (call it "CarSteeringIncrement" or such) and reference the game attribute in the rules above. That would allow for easier testing with different values and also if you allow the player to upgrade their steering in the game, you just need to change it in one place...the game attribute "CarSteeringIncrement".
So the rules above become:
If pressing "R" then change attribute self.rotation to self.rotation - game.CarSteeringIncrement
If pressing "L" then change attribute self.rotation to self.rotation + game.CarSteeringIncrement
I hope you get it to work.
Take a peek at the movement rules for the car in the car demo project/template.