GithubHelp home page GithubHelp logo

jochen2sfusd / lightning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apcslowell/lightning

0.0 0.0 0.0 147 KB

An AP Computer Science A programming assignment for Mr. Simon's APCSA course at Lowell High School, San Francisco, USA

Processing 0.28% JavaScript 99.52% CSS 0.07% HTML 0.13%

lightning's Introduction

Lightning

One way to simulate lightning is with a random walk. In this assignment you will create a program that uses a random walk to seemingly shoot lightning from one side of the screen to the other every time the mouse is pressed. You may find sides 16 to 40 of the apjavaProcessing slide presentation helpful.

Suggested steps to start the assignment

  1. Sign up for a free GitHub account
  2. Then fork this repository
  3. Open the Lightning.pde file. Copy and paste the code into Processing.
  4. At the top of the program in Processing, declare 4 int variables startX, startY, endX and endY. Initialize startX to 0, startY to 150, endX to 0 and endY to 150
  5. void setup() needs to set the strokeWeight() and background() of your applet
  6. void draw() needs to do two things:
    -set the stroke()color of the lightning bolt to some random value using Math.random()
    -a while loop that repeats the following until the endX is off the screen:
    1. set endX to startX plus a random integer from 0 to 9
    2. set endY to startY plus a random integer from -9 to 9
    3. draw a line() with endpoints startX,startY,endX,endY
    4. set startX equal to endX
    5. set startY equal to endY
  7. void mousePressed() needs to set startX,startY,endX,endY back to their original values.
  8. When you are happy with the program, copy and paste it back into GitHub
  9. You will also need to modify index.html to customize your website with it's own title, headline and footer. When you are happy with your program, push your finished project up to GitHub
  10. The final step is to submit the URL for your website to google classroom. Don't hesitate to ask for help if your aren't sure how something is suppose to work.

Program requirements

The steps above are only a suggestion. Your program needs to use Math.random() for all random numbers in the assignment. Other than that, your lightning program doesn't have to work or look like any other. Have fun and be creative!

Samples of Student Work

Justine
Jasmine
Kai
Cara
Marlon
Rishi
Johnny
Alexander
Kang
Joaquin
Luna
Edison
Kimia
Connie
Richard
Kazu
George
Annika
Qi
Verena
Yanzhu
Claire
Melanie
Tommy
Ayaka
Phuoc
Madeline
Rafael
Jaqueline
Rameses
Ian
Anna
Allister
Noah
Xinjian
Lucas
Kendrick
Kenneth
Andrew
Kasra
Marvin
Cheryl
Andrew
Austin
Daniel
Ciaran
Lance
Angel
Maanav
Philip
Andy
Jayde
Albert
Jennifer
Diego
Brandon
Jalen
Andy
Jason
Ian
Jocelyn
Eloy
Alexis
Anson
Chris
Annie
Susan
Wen
Frida
Mia
Damien
Jessie
Cindy
Vicky
Eric
Esme
Caitlin
Angel
Henry
Alex
Henry
Jun
Michael
Marvin
David
Jessie
Norton
Iryne
Esther
Branson
Omar
Celina
Anthony
Akira
Dalton
Emma
Yaoquan
Mari
Lily
Sean
Freesia
Alexander
Cappillen
Joshua
Megan
Brendan
Amy
Jae
Angelica
Jackson
Andy
Audrey
Rowan
Ian
Henry
Dylan
Michael
Jennifer
Celena
Gordon
Richard
Nathan
Lily
James
Gordon
Donald
Emma
Vincent
Jeffrey
Emily
Warren
Prescott
Jing
Oona
Natalie
Rolland
Emil
Chris
Lilith
Wilson
Jeffrey
Sarah
Emily
Andrew
Mandy
Kelly
Albert
Clarisse
Tatyana
Chanel
Scott
Andrew
Athena
Alexander
Mariann
Jonathan
Bryce
Connie
Triston
Chloe
Jasmine
Ben
Justin
Jeffrey
Jack
Kelvin

lightning's People

Contributors

simart avatar jochen2sfusd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.