2
$\begingroup$

In the BGE is there a way, using just logic bricks and not Python, to format an integer text object so that it stays right justified within a field.

Let's make this a simple two digit number between 0 and 99. When the number changes from 9 to 10, I want the 1 to shift one digit to the left and the 0 to remain in the units position. There are two ways I found to do this, neither very elegant.

One way is to use ( with a single ALWAYS SENSOR ) a two frame animation defining the two positions ( a tens position and a units position ) with two EXPRESSION CONTROLLERS, one for the integer less than 10 and the other for the integer ten or greater. Each controller is attached to an ACTION ACTUATOR that selects the appropriate position frame. The other way I found was to use constraints in a logic brick setup similar to the position animation just described.

Is there a more elegant way or some feature I'm missing in the logic bricks?

$\endgroup$
3
  • $\begingroup$ without python, not really. The method you've suggested would certainly work. (elegant isn't always important) $\endgroup$ Commented Aug 15, 2016 at 12:45
  • $\begingroup$ Replace the always with a Property sensor in mode: "Changed". $\endgroup$
    – Monster
    Commented Aug 16, 2016 at 4:58
  • $\begingroup$ Thank you both. X-27, chuckle, I agree. In programming I have often abandoned the quest for elegance in the name of utility. Monster, thank you for showing another way ( elegant or not ) for accomplishing what I wanted to do. $\endgroup$
    – Dragonbyte
    Commented Aug 16, 2016 at 20:03

1 Answer 1

2
$\begingroup$

Not really elegant: enter image description here

I guess this is pretty similar to your solution.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .