Property Controlled IPO/Action

I was trying to run an IPO anim with a property value. To be more specific, my player has fuel and the fuel needs to be constantly decreasing. So I figured I could animate a simple plane scaling down to 0 and that would be the visual for the fuel. I had the sensor add 1 to the init property value every 30 ticks so the number would slowly increase, therefore slowly Decreasing the fuel visual. That wasn’t working for some reason so I tried attaching the plane to an armature and animating the armature scaling down. But it’s still not working. I’ve seen it before in other blends but I can’t seem to get it working right. I’ll load a pic of what I’m doing if that will make things easier.


The property’s an integer? You specified the property in the ipo actuator? You’re sure the plane scales down as the frames go up, not the other way around? Is the property itself working correctly? Go to Game > Show Debug Properties, and check the “D” next to the property, so you can see the property value when you run the game.

I already did all of that. I know for a fact the my prop is working correctly. And the ipo scaling is going the right direction. And yes I did specify the prop in the ipo actuator.

The last one I can think of is Did you press P? Otherwise, post a .blend.

I’m assuming that your property is changing as you want it to (you should be able to debug that by pressing the “D” next to the property value (where you created the property) and then “Game -> Show Debug info” in the menu bar that is the top row.

Creating the IPO:
-Open an IPO window in a side block.
-Go to frame one
-In the main window, select the desired object (the fuel bar) and press i key. Press Scale.
-Go to frame 25 (any number will work)
-Scale the object to 0 along the x axis or whatever axis is the width of this bar (s key, x key, 0 not on the numpad, enter)
-Press i key again, and hit scale again.
Now, as you go through the frames in the editor, you’ll see the object change size.
By default, this takes the form of a bezier curve, while you probably want a constant change.
-In the IPO window, select all dots by pressing the a key, and then in the menu at the bottom of the IPO window: Curve -> Interpolation mode -> Linear

Setting up the Logic:
-Create the property on your object. Set it’s type to that of an integer.
-Create two sensor logic blocks, one property and one delay. Set the delay value to 10, leave the DUR value at 0, and turn on REP. Set the property sensor to type of “Not Equal” the property name to your property, and the value to 25.
-Connect both of these sensors to an AND controller.
-Create two actuators. Set one to type IPO, and the other to type property. Set the property to “ADD” type, input your property name, and set the add value to 1. Set the IPO to type “Property” (instead of Play). Input your property name where it says Prop:
-Connect both actuators to the single controller you created.

Test it.

Here is roughly what you should have:

The property used to set the frame of the ipo must be on the object affected by the ipo.The not equal propertysensor stops it from counting when the fuel is empty, but is not entirely necessary. Values can be tweaked to achieve the desired effect. If you want it to be fuel left, not fuel used, set the ipo to be scale 0 at frame 1 and scale full at frame 25. Set the fuel property to start at 25, and change the add actuator to add -1 instead of 1.If you attach the IPO to every controller that changes the value, it should work, but if you prefer, you can just connect it to an always sensor-run controller to always update. You can use always instead of delay, and just have pulse mode with a delay between pulses set to 10 or whatever if you prefer.

Hey! Thank you Almost. I just redid it according to your picture and it worked fine. My fuel bar goes down quite nicely now and will provide a good challenge to the player. Thanks again.