Showing the changes to scripts/tutorials/entity_scripts (1 of 6 files). Show all
Unified · Split
| @@ -15,35 +15,35 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | function MidiSphere() { |
| 17 | 17 | _this = this; |
| 18 | − this.clicked = false; | |
| 19 | − return; | |
| 18 | + this.clicked = false; | |
| 19 | + return; | |
| 20 | 20 | } |
| 21 | − | |
| 21 | + | |
| 22 | 22 | MidiSphere.prototype = { |
| 23 | 23 | preload: function(entityID) { |
| 24 | 24 | this.entityID = entityID; |
| 25 | − Midi.midiNote.connect(function(eventData) { | |
| 26 | − print("MidiSphere.noteReceived: "+JSON.stringify(eventData)); | |
| 27 | − Entities.editEntity(entityID, { color: { red: 2*eventData.note, green: 2*eventData.note, blue: 2*eventData.note} }); | |
| 28 | − }); | |
| 29 | − print("MidiSphere.preload"); | |
| 25 | + Midi.midiNote.connect(function(eventData) { | |
| 26 | + print("MidiSphere.noteReceived: "+JSON.stringify(eventData)); | |
| 27 | + Entities.editEntity(entityID, { color: { red: 2*eventData.note, green: 2*eventData.note, blue: 2*eventData.note} }); | |
| 28 | + }); | |
| 29 | + print("MidiSphere.preload"); | |
| 30 | 30 | }, |
| 31 | 31 | unload: function(entityID) { |
| 32 | − print("MidiSphere.unload"); | |
| 32 | + print("MidiSphere.unload"); | |
| 33 | 33 | }, |
| 34 | 34 | |
| 35 | − clickDownOnEntity: function(entityID, mouseEvent) { | |
| 36 | − print("MidiSphere.clickDownOnEntity"); | |
| 37 | − if (this.clicked) { | |
| 38 | − Entities.editEntity(entityID, { color: { red: 0, green: 255, blue: 255} }); | |
| 39 | − this.clicked = false; | |
| 40 | − Midi.playMidiNote(144, 64, 0); | |
| 41 | − } else { | |
| 42 | − Entities.editEntity(entityID, { color: { red: 255, green: 255, blue: 0} }); | |
| 43 | − this.clicked = true; | |
| 44 | − Midi.playMidiNote(144, 64, 100); | |
| 45 | − } | |
| 46 | − } | |
| 35 | + clickDownOnEntity: function(entityID, mouseEvent) { | |
| 36 | + print("MidiSphere.clickDownOnEntity"); | |
| 37 | + if (this.clicked) { | |
| 38 | + Entities.editEntity(entityID, { color: { red: 0, green: 255, blue: 255} }); | |
| 39 | + this.clicked = false; | |
| 40 | + Midi.playMidiNote(144, 64, 0); | |
| 41 | + } else { | |
| 42 | + Entities.editEntity(entityID, { color: { red: 255, green: 255, blue: 0} }); | |
| 43 | + this.clicked = true; | |
| 44 | + Midi.playMidiNote(144, 64, 100); | |
| 45 | + } | |
| 46 | + } | |
| 47 | 47 | |
| 48 | 48 | }; |
| 49 | 49 | |