Moving an Actor forward in its rotation

rommaromma Member Posts: 114
edited May 2012 in Working with GS (Mac)
Hey Guys,

I have a few rules set up where if "keys" (left/right) are pressed to change the rotation of the actor CW / CWW. Ideally I want this same actor to "move forward" (currently using accelerate) with a "key" (up) pressed state, the problem I have is that it's moving forward but not in the angle it's supposed to move.

I know the vectorToAngle(x,y) with LinearVelocity formula but it's not working, maybe Im just not implementing it correctly.

Thanks for your time!

Answers

  • rommaromma Member Posts: 114
    I have it right and it moves like the classic asteroid game. I want it to move like PuzzleDozers dozer.

    Thanks!
  • rommaromma Member Posts: 114
    I changed my Accelerate to Move and it works like I want to. Is this a "semantic" way of using move?
  • rommaromma Member Posts: 114
    Ok,

    How do I use the accelerate behavior to move my actor just like the Dozer from PuzzleDozer?

    I have the rotation set up already.

    Please point me in the right direction. Thanks!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited May 2012
    when key up is pressed
    -Accelerate relative to actor direction 0 like tshirt said.

    Also add some drag to the actor, and maybe friction. Its under its physics attributes.
  • rommaromma Member Posts: 114
    Hey Tshirt, I did it this way, and also added a boolean to set true is KEY = UP so that I could change LinearVelX,Y when False. The problem is that now the actor doesn't turn if Im "moving forward"
  • rommaromma Member Posts: 114
    I think I will make my post again as my original post and titles dont describe my need.

    Thanks!
  • rommaromma Member Posts: 114
    edited May 2012
    Hey Guys,

    Im having a hard time replicating on how the 'dozer' moves in PuzzleDozer. Rotate left/right whilst moving forward is whats getting the best of me. All these movements are being "ruled" with on press KEY events.

    Any headsup would be appreciated!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Have you looked at the "Race Car DEMO" in GameSalad-->New ?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • rommaromma Member Posts: 114
    Yes of course, but it has the same issues as I do. It's like we're in an ICE Arena, sliding everywhere.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited May 2012
    @ romma

    Try adding drag and friction maybe density . There in the physics attributes. Just play around with the amounts.
  • rommaromma Member Posts: 114
    edited May 2012
    Yes, but the main problem still persists.

    It seems like im "drifting" when moving my actor. When I press UP to move forward and turn, the actor turns on its axis but doesn't move torwards that angle of direction unless I press the UP again. (up having the acelerate behaviour to move forward)
  • rommaromma Member Posts: 114
    Bump.
  • lordxeludzenlordxeludzen Member Posts: 3
    I totally understand what you're trying to accomplish, as I am trying to do the same at this moment. Its like when you lift your foot off the gas pedal you continue to move forward, at the same time you want to turn left or right and you do so by not having to press the gas again. I am going to continue to work with it and I will let you know what I get. :)
  • LumpAppsLumpApps Member Posts: 2,881
    I don't understand the problem but I'll give it a try anyway.

    Ad a constrain to your actor and do the following.
    Constrain self.rotation to vectortoangle(self.motion.linear velocity.x,self.motion.linear velocity.y)

    That way the car always points in the way it is moving. As @tShirtBooth says, make sure you have the actors image pointing to the right!
  • rommaromma Member Posts: 114
    @LudwigHeijden

    That doesn't work makes my actor go crazy when I turn him, remember I have a Rotate CW on keypress RIGHT.
  • LumpAppsLumpApps Member Posts: 2,881
    Like I said. I didn't completely understand your problem.
    Perhaps when you fake pushing the up button by adding a forward movement when you turn as well as the rotate cw/ccw. That would keep the car rolling when you turn though.
Sign In or Register to comment.