inkey for integers/floats?

Posted By: MattyTheG

inkey for integers/floats? - 11/24/08 14:35

Hey guys, I'm working on a game where I want the user to be able to enter a launch angle, which will then be set to the objects tilt. Is there any type of function that is like inkey() but for numbers instead of strings? I tried using inkey and just entering numbers into the string but it didn't seem to do anything. I'm using lite-C by the way. I know how to do it in C++ but not everything else so I chose lite-c hah.

Thanks in advance for the help.
Posted By: heinekenbottle

Re: inkey for integers/floats? - 11/24/08 15:43

Try str_to_num, str_to_float and str_to_int

These three functions turn a string into a var, float and int respectively.

So you'd use inkey to get the string from the player, and then use one of the above instructions
© 2024 lite-C Forums