Browse Source

autoplay and settings compatibility

shuvit 5 years ago
parent
commit
c29dde6497
1 changed files with 12 additions and 1 deletions
  1. 12
    1
      MusicPlayer.py

+ 12
- 1
MusicPlayer.py View File

@@ -74,14 +74,25 @@ class MusicPlayer(bge.types.KX_PythonComponent):
74 74
         last_y = up_dict['last_yBut']
75 75
         JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
76 76
         
77
+
78
+        #Run player on startup
79
+        if up_dict['music_start'] == True:
80
+            if self.isPlaying:
81
+                self.stopMusic()
82
+            else:
83
+                self.playMusic()                 
84
+            up_dict['music_start'] = False               
85
+
77 86
         # Music controls only during pause/replay
78
-        if up_dict['npause'] == True or up_dict['playback'] == True:
87
+        if (up_dict['npause'] == True or up_dict['playback'] == True) or up_dict['music_start'] == True:
79 88
             #stop/play
80 89
             if (y == False and last_y == True) or pKey == JUST_ACTIVATED:
81 90
                 if self.isPlaying:
82 91
                     self.stopMusic()
92
+                    up_dict['music_player'] = 0
83 93
                 else:
84 94
                     self.playMusic()
95
+                    up_dict['music_player'] = 1
85 96
             # Prev/Next
86 97
             if self.isPlaying and self.handle.status:
87 98
                 if pMinus == JUST_ACTIVATED or (lb == False and last_lb == True):

Loading…
Cancel
Save