0
$\begingroup$

I am having a hard time trying to manipulate the rotation of every object on a list:

import bge
import bpy

cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()

keyboard = bge.logic.keyboard #Declare Keyboard
wKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.WKEY] #Declare Keys
sKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SKEY]
dKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DKEY]
aKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.AKEY]
spaceKey = bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events[bge.events.SPACEKEY]

wKey_rel = bge.logic.KX_INPUT_JUST_RELEASED == keyboard.events[bge.events.WKEY]

cubes = (scene.objects["Cube.3"], scene.objects["Cube.4"])
for x in cubes:
    if spaceKey:
        x.applyRotation((0,.1,0), False)
        cubes.append(scene.objects["Cube.5"])
        print(cubes)
        break

The thing is that it works, but it only applies rotation to the first object and if I use x[0:3] or cubes[0:2] it doesn't work at all. What I am doing wrong?

$\endgroup$
  • $\begingroup$ never ever import bpy! - It is the Blender API which is not available within the final game. $\endgroup$ – Monster Jan 25 '18 at 5:28
0
$\begingroup$
  1. AttributeError: 'tuple' object has no attribute 'append'

  2. You explicitly break your loop.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.