I am trying to make a sort of music thing, and I have a keyboard made up of multiple objects. When a key is clicked, it plays a note. It is currently made in CoBlocks, and I want to make it in JavaScript, but am not sure how to go about it.
If there isn’t an equivalent in Javascript, how would I work around this?
Hi @adamkostakos,
Here’s an example, with links to the API:
const keyC = Scene.getItem(“Key C”) as Cuboid; // example
const soundC = Sound.load(“put sound ID here”);
keyC.input.onClick(()=>{ soundC.play(); });
// Note: ()=>{} is shorthand for function(){}
Hope that helps! Let me know if you have any further questions about this. If this solves your problem, please mark this post as the Solution.
Many thanks,
Geoff @ TechLeap