MichaelSinsbeck / platformer

A ninja platformer written in LÖVE
7 stars 0 forks source link

Numeric properties #214

Closed michalove closed 10 years ago

michalove commented 10 years ago

Since we have a functionality for text input for properties, I though, we could also have a free text box for entering numbers.

Would that be easy to implement (run tonumber(text) on the inserted text and accept, if successful)?

That way a lot more fine tuning would be possible with all the angles and velocities and so on.

Germanunkol commented 10 years ago

That's a good idea and definitely possible. I'll look into it.

Germanunkol commented 10 years ago

A first prototype is done. For an example, see the speed property of the windmill object (edit: or the npc object). The function to add a new "numeric text" property is called with a default, minimum and maximum values. We could add a "precision" value as well, i.e. the maximum number of digits behind the decimal point. But I don't know if it's necessary, and as long as it isn't, I'd leave it away (allows maximum freedom for the user).

michalove commented 10 years ago

(haven't tested yet), but I think we don't need a precision value. Default, min and max are enough.

The only precision-related aspect we could think through is for integer values. These can either be implemented with normal properties (click button to change value) or as a number input property, which only allows integers. What do you think is more natural. If you want to change the number of wings of the windmill. Would you rather type in a number or press left/right to get the number?

And (haven't tested yet) do you think we need to display the minimum and maximum value somewhere? That would avoid some frustration, if the user tries to input a number and it is always corrected to the maximum value.

Germanunkol commented 10 years ago

Displaying the min and max will be hard (we already have no space as it is). I think it's fine as it is now. I would keep integer values "clickable", i.e. the user should not enter them through textinput, if the values stay within a range of, say, ten. If we need more than that (I can't think of any property where that's currently the case), I can easily implement a version of the input box which only accepts integers.

michalove commented 10 years ago

You are right, the integer valued properties usually have a very small range and we can use the arrows. I close this issue.