Get students coding explosions with Javascript!

Want your students to try text coding with Javascript/Typescript? Here’s a really good reason for them to learn…

There’s nothing like a good explosion, and CoSpaces has a nifty script function called createExplosion in the Physics module, which allows you to create explosions anytime, anywhere, in your CoSpace.

This function/method is not currently available as a CoBlock (as of 18/02/2020), so it can be a good way to spark student interest in text coding via Javascript/Typescript.

Remix this CoSpace, set it as an assignment, and get your students to mess with the createExplosion parameters, to change the radius and power of the explosions.


They can then experiment, introducing other shapes & items into their scene (remember to turn on physics & precise collision!), and test the results!

See API details for this method at https://cospaces.io/api/modules/physics.html#createexplosion

PS: a FUNCTION is a bunch of code that packaged up & given a name, so that we can refer to it without writing out the code again.

PPS: a METHOD is a function that is associated with an object.

2 Likes

Awesome bit of code for a project!! I’m hoping to learn some more about coding in Script

1 Like