Start/Stop Music Code Help

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Sun Feb 12, 2012 6:26 pm

Start/Stop Music Code Help

Post by 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:


Post Reply