GithubHelp home page GithubHelp logo

awesomestickman / snowflakecatcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apcslowell/snowflakecatcher

0.0 2.0 0.0 90 KB

Processing 0.44% HTML 0.13% JavaScript 98.76% CSS 0.07% Java 0.61%

snowflakecatcher's Introduction

Snowflake Catcher

In this assignment you will create a class to model a single snowflake. Then you will create an array of many snowflakes.

Steps to completing the program (These are just a suggested starting point. Feel free to adjust them anyway you'd like):

  1. Sign in to GitHub and fork this repository

  2. Add the following to the Snowflake class.

  • 2 member integer variables: x and y
  • 1 member boolean variable: isMoving
  • The constructor should initialize the members as follows:
    • x: random integer from 0 to 300 (or whatever the width of the screen is) You must use Math.random()
    • y: random integer from 0 to 300 (or whatever the height of the screen is) You must use Math.random()
    • isMoving: true
  • void erase() which first, sets the fill to black and draws a black ellipse of size 7 at (x,y)
  • void move() which checks if the snowflake isMoving. If it is, increase y by one
  • void lookDown() checks if y is between the top and bottom of the screen, and the position just below (x,y) is not black. If so, set isMoving to false; otherwise set isMoving to true
  • void show() which draws a white ellipse of size 5 at x,y
  • void wrap() which checks if the y coordinate is off the bottom of the screen. If it is, set y to 0 and generate a new random x coordinate
  1. Now create an array of Snowflakes. In draw() write a loop that goes through the array and for each snowflake does the following:
  • erase()
  • lookDown()
  • move()
  • wrap()
  • show()
  1. In mouseDragged() write some code that draws to the screen.
  2. When you are happy with your assignment, push your repository to your GitHub account. Submit the url of your working program to the school loop drop box.

Samples of Student Work

Chris
Zachary
Teresa
Lily

snowflakecatcher's People

Contributors

simart avatar awesomestickman avatar

Watchers

James Cloos avatar  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.