Start/Stop Music Code Help

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Posts: 13
Joined: Sun Feb 12, 2012 6:26 pm

Start/Stop Music Code Help

Postby Zoeo » Wed Aug 08, 2012 8:48 pm

Okay so I'm trying to test a code so that when my "Cube" or player or cursor or whatever is near the Empty, it will turn the music on or off, so far I've been unsuccessful, I'm very new to coding and need some help :?

Here's the code I tried:

Code: Select all

import bge

def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner
    player = bge.logic.getCurrentObject('Cube')

    sens = cont.sensors['Play']
    actu = cont.actuators['Music']
    sens.distance = 0.50

    if sens.positive:


Return to “Coding Blender”

Who is online

Users browsing this forum: No registered users and 0 guests