Increase speed?

Ok so, I need to know, is there a way to increase you speed a bit each time you press a button? As long as it’s below a certain value.

Yes, it involves python. I can wip up a .blend if you would like…

You could use an integer property. Every time you hit the key and the integer is less than whatever, the property increases by 1. Then use Python to set that as the force or linear velocity or whatever you want to use.

I think, I’m not sure that you could use the “add” button in linV on the motion actuator.

The add thing doesn’t work. So, how would I do it with python?

when you press a button it adds a number to a property. Then you’ll set the speed of what ever it is to that property.

LOL you dont need python or any crap
this is what you do
make a property for your speed (preferable integer)
then make a key sensor for add (example ‘+’)
link that to an expression controller and in that write (Speed < 100)
and connect that to a property actuator that adds 1
same with decrease speed, except that in the expression its (speed > 0)

to explain simply, the expression controller lets you increase or decrease a speed until it is greater or less than a certain value

hope it helps!:slight_smile:

OK. So it’ll add to the property but you didn’t explain how the speed will be controlled with it.

In python you could make a motion actuator called “motion” and in python maybe try

motion = motion + 1

But then how do I link that to speed?

Here you go bro. If you have any further questions, ask away (for instance, I could make you an example where a keypress is required, or where it maxes out at a current speed, etc.)

~Túrin

Ok cool thanks.

here ive got a script for that
‘throttle’ is ur property
‘t_up’ is throttle up and ‘t_down’ is down

do this:


co = GameLogic.getCurrentController()
o = co.getOwner()

if t_up.isPositive():
    o.throttle += 1

if t_down.isPositive():
    o.throttle -= 1

if o.throttle &gt; 100:
    o.throttle = 100

if o.throttle &lt; 0:
    o.throttle = 0


if u put pulse mode on itll give it a nice polish, although ull have to do it on a low integer, which depends on what you want

hope it helps :slight_smile:

Ok cool thanks a lot.