not sure if this post should be here or in the python section, but i am trying to make a targets objects Z scale go up in increments of .5 until its total Z scale is 10 a ‘cube’ comes close to it, then the target objects scale with go back to its original scale in increments of .5 when the object moves away.
cont = bge.logic.getCurrentController() own = cont.owner if not own.localScale in own: own.localScale = ([1,1,1]) scene = bge.logic.getCurrentScene() target = scene.objects["Cube"] dist = ( own.getDistanceTo(target)) Scaler = .5 if dist<.5: if own.localScale.z <10: own.localScale.z += Scaler else: if own.localScale.z >1: own.localScale.z -= Scaler
this is the script up to now, but it only adds one .5 to the scale of the target object then takes it away when the ‘cube’ moves away. i cannot seem to find a way to apply multiple .5 increments till it reaches the correct size. can anyone help?