Print yvelocity Problem.

Talk about making games.

Print yvelocity Problem.

Postby Behdadsoft » Tue Jun 17, 2014 7:30 am

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
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: Print yvelocity Problem.

Postby Goettsch » Tue Jun 17, 2014 1:55 pm

you can create a text actor and use this code:

MyActor -> Draw Actor -> Script editor ->
Code: Select all
MyActor.textNumber=player.yvelocity
Support me and open these links:
http://adf.ly/pZps0 (as many times as you can)
http://VisitsToMoney.com/index.php?refId=470333 (open once)
http://Visitors2Cash.com/ref.php?refId=169224 (open once)
My games:
Kingdoms of... http://adf.ly/pZq5O
Goettsch
 
Posts: 124
Joined: Fri Jun 28, 2013 10:00 pm
Score: 5 Give a positive score

Re: Print yvelocity Problem.

Postby DarkParadox » Tue Jun 17, 2014 10:44 pm

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.
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: Print yvelocity Problem.

Postby Behdadsoft » Wed Jun 18, 2014 5:15 am

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:
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron