How to find an actors speed/velocity

crazyfishdevcrazyfishdev Member Posts: 283
edited November -1 in Working with GS (Mac)
Ok , so in a game I am making I have an Actor and he Is able to move and I want to make it so that I can have another actor on the screen displaying its speed. How would I do this? I can display the text on the actor that is moving but I want it on another actor. thanks, <><

Comments

  • simo103simo103 Member, PRO Posts: 1,331
    you will need to create a game attribute and constrain the movement of teh actor to that attribute. then in the text display that attribute
  • crazyfishdevcrazyfishdev Member Posts: 283
    I have tried this but it still does not work... I would be glad to give you a free version of my level editor template for help.
  • simo103simo103 Member, PRO Posts: 1,331
    I'll be happy to help for free (though thanks for offering ... I kinda believe what goes around comes around if you know what I mean).

    I could throw together a quick template with it working and send it over if you think that would help or is it likely you have some more complex coding that is causing yours not to work?

    EDIT: or you could try TSB's code :D
  • crazyfishdevcrazyfishdev Member Posts: 283
    tshirtbooth said:
    Ok make a game attribute game.itsspeed

    On the actor that is moving

    constrain game.itsspeed to magnitude(self.motion.ang.vol.X,self.motion.ang.vol.Y)

    then you can display game.itsspeed

    That should work for you

    _________________________________________________________________________________

    FREE YOUTUBE VIDEOS HERE
    Menu System #2 Template HERE
    Cover Flow and level unlock Template HERE
    Missile Command Template HERE
    Tiki Totem style template HERE
    Labyrinth TemplateHERE

    sorry to say that this did not work as well, working on vid to show problem. btw. my gs only has ang.vol it does not have X,Y... but linear does and cant get that to work as well
  • crazyfishdevcrazyfishdev Member Posts: 283
    If you would not mind sending a template that would be great. there is not much code yet so I am not sure whats going on...
  • simo103simo103 Member, PRO Posts: 1,331
    hey crazyfishdev ... if okay with you I'll let tsb get the demo to you (as I know it will show the right way to do it).

    I'll be back in the forums later so if you are still having issues I can see what I can do then.
  • crazyfishdevcrazyfishdev Member Posts: 283
    Ok I got It to work! thanks for all the help! No need for the templates but thanks for the offers
Sign In or Register to comment.