Page 1 of 1

Print yvelocity Problem.

PostPosted: Tue Jun 17, 2014 7:30 am
by Behdadsoft
Hi.

I want Print yvelocity that show what is the Player yvelocity number.

I add this script to MyActor=>Draw Actor=>Script Editor:

Code: Select all
sprintf(texts.text, "%d", Player.yvelocity);


but always show 0 value. can anyone help me?

Thanks

Re: Print yvelocity Problem.

PostPosted: Tue Jun 17, 2014 1:55 pm
by Goettsch
you can create a text actor and use this code:

MyActor -> Draw Actor -> Script editor ->
Code: Select all
MyActor.textNumber=player.yvelocity

Re: Print yvelocity Problem.

PostPosted: Tue Jun 17, 2014 10:44 pm
by DarkParadox
It's true that Goettsch's solution will work in this case, but I thought I should let you know why your code wasn't working too: In your sprintf you use the placeholder "%d" which is meant for integers, but yvelocity is a double. You have to use "%f" for floats and doubles.

Re: Print yvelocity Problem.

PostPosted: Wed Jun 18, 2014 5:15 am
by Behdadsoft
you can create a text actor and use this code:

MyActor -> Draw Actor -> Script editor ->
CODE: SELECT ALL
MyActor.textNumber=player.yvelocity


Yes work thanks Goettsch.
+1 :wink:

It's true that Goettsch's solution will work in this case, but I thought I should let you know why your code wasn't working too: In your sprintf you use the placeholder "%d" which is meant for integers, but yvelocity is a double. You have to use "%f" for floats and doubles.


Yes RightI mistake.
Thanks +1 :wink: