Property refuses to change

Hello,
I have a very simple script, but the property just refuses to change even though I am 100% it passes through that part of the script:


def speed(cont):
    cont = gl.getCurrentController()    
    own = cont.owner


    space = cont.sensors["space"]
    
    if space.positive and own["Fspeed"] < 20:
        
        own["Fspeed"] += 0.25
        print(own["Fspeed"])

I have a property on the object called Fspeed, I have an always sensor attached to it and a keyboard sensor called “space”

it is connected to a python module called “test.speed”, the script is called “test” and the function is called speed (as you can see in the script)

AND YET IT REFUSES TO DO ANYTHING
It doesn’t even give an error. The print gives constantly 0. (debug properties also shows that own[“Fspeed”] does not change)

How is this even possible? No errors, but still nothing happens.

Also attached the .blend

Attachments

dafuq.blend (407 KB)

Your property is an integer ,change that to float in order to make it work,or simply use integer numbers. fspeed+= 1 not fspeed +=0.25.

Fspeed is an integer so when you add 0.25 it rounds to the nearest whole number, the nearest whole number being 0! you need to change Fspeed to a float.

Edit: pipped to the post by BlendingBGE :stuck_out_tongue:

God I’m retarded =.=