Help with unexpected behavior with expressions/ properties

Hi there again!

Been trying to make a side strafe action for my racing game that has a button delay to stop people using it all the time.

However, if the slide_l is equal to 10 in the debug value (the same as the property) the ship strafes out of control. (If you tap the z key continually it will eventualy do this).

What is going on? Can someone talk me through the problem (and how to solve it?). If possible a logic block answer, although I would be interested to see how Python would do it.

Many thanks for your time!

Paul

Attachments

funky_logic.blend (439 KB)

fixed it, there was tonnes of redundant logic, I made it so there is a toggle property which can be edited to disable sliding, perhaps if the player goes over a trap?

funky_logic.blend (412 KB)

:smiley:

This is becoming a habit! Thanks for your help- I did do something similar but it must have passed me by!

Cheers (again) boss!:cool::cool:

Paul

By the way, can you tell me what the logical error was? It was doing my head in trying to work it out (not to mention lots of cups of tea).

Tea! :smiley:

from what I could see I think I know what you’d tried to do; you’d tried to make the slide property act as a “buffer” so that the slide only trigger once, so that when you’d held it for about half a second, it bumped the vehicle to the side (perhaps you forgot about the “tap” option on the sensors? :D) then the expression tested the property and turned it back to zero, to start the cycle over again.

(With the expression controller, you could see with the debug properties (for some reason, perhaps to do with the sensor and the priority (Higher up logic bricks have highest priority, except marked controllers) ) the property was allowed to climb infinitely while Z was held. though this didn’t have any effect on the use because when you let go of Z it returned instantly to 0. I assume you’d added the “buffering” effect of the property intentionally to prevent the user being able to bump themselves for a long time or very often?

I have no idea why it made the ship fly off to the side, as far as I could see, what you’d done hould have worked, if not with a little redundant processes…

Hope that abstract paragraph clears it up a little. <—what an oxymoron… :o

(you’d basically emulated the “tap” option with properties :eek:)

Thanks for the info!