Car game problem

panicqpanicq Member Posts: 27
edited November -1 in Working with GS (Mac)
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 :)

Comments

  • panicqpanicq Member Posts: 27
    nobody?
  • rebumprebump Member Posts: 1,058
    Make sure the rule in the actor (the car) you use for determining if "right" and "left" is touched/held each contain one of the "rotate" behaviors implemented with the appropriate direction of rotation. Also, instead of a "rotate" behavior, you could just use a "set attribute" behavior to set the actor's rotation to be equal to the current rotation plus some amount (say 5 degrees). Different ways to handle it. That should handle the rotation direction and actor sprite rotation to go along with it.
  • panicqpanicq Member Posts: 27
    Mmm i dont realy understand, I just change the self.rotation to self.rotation in the car actor with the change attribute behavior?
  • rebumprebump Member Posts: 1,058
    Well, if you don't use any of the "rotate" behaviors, you would just use "change attribute" so...

    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
  • rebumprebump Member Posts: 1,058
    The car demo project, if I recall, does rotate the car when steering...you may want to re-open a fresh version of it and poke around.
  • panicqpanicq Member Posts: 27
    Just one thing: Thank you very much for you help :)
  • rebumprebump Member Posts: 1,058
    np!

    I hope you get it to work.
  • panicqpanicq Member Posts: 27
    Hello again I have an other PB can you re- help me please? I cant controll the car beacause she is like on the ice?
  • rebumprebump Member Posts: 1,058
    You'll have to fiddle with the acceleration, drag, etc.

    Take a peek at the movement rules for the car in the car demo project/template.
Sign In or Register to comment.