(Cornwall) - Simulating Lots of Things with Objects and Classes


Details
In this session we continue our journey learning to code creatively with Javascript and p5js.
---
Sometimes we want to model or simulate many "things" of a similar kind. For example, we might want to model the movement of 400 ants around a surface, or 50 bouncing balls in a container.
We don't want to write code for each one of these many objects separately, that would be very laborious. A better approach is to describe a blueprint for the "things" and use that blueprint to create many many "things" in a very elegant way.
This means we'll be learning about Objects and Classes - an important concept in many programming languages.
---
In this step-by-step tutorial we'll start small and grow our code to implement a simple simulation of bouncing balls that move realistically under gravity.
Bring your laptop or follow along as we:
Code:
- animate a single ball
- apply the rules of gravity to the ball
- bounce the ball off edges and the ground
Theory:
- introduce the idea of objects and classes
Code:
- re-implement our ball as a class and create an object
- show how we can easily have 10, even 100, balls using the same "blueprint"
---
This session is suitable for anyone who is a beginner in coding, and has perhaps started using javascript, or has followed our structured creative coding course: https://sites.google.com/view/creative-coding-for-kids
---
This is a hands-on tutorial so please bring a fully-charged laptop with working wifi.
---
The session starts at 6.00pm and you can arrive a few minutes before this. Car parking is free in the evening in some of the local council car parks including Garras Wharf car park.

(Cornwall) - Simulating Lots of Things with Objects and Classes