Code Monkey home page Code Monkey logo

squirrel's Introduction

🐿️Squirrel🐿️

A Pixel-Art Squirrel 🐿️ that lives in the Forest 🌳 and searches for Acorns 🌰. Written in P5JS using P5.Play

Squirrel

Copyright & Attribution

Squirrel: Elthen / Elthen on Patreon License: CC BY-NC 4.0 / Forest-Assets: Ansimuz License Acorn: Ansimuz License: CC0 Birds: "[LPC] Birds" by bluecarrot16, commissioned by castelonia. Licenses: CC BY 4.0 & CC BY 3.0 & CC BY-SA 4.0 & CC BY-SA 3.0 & GPL 3.0 & GPL 2.0 & OGA-BY 3.0

About the Project

The Code is written in P5JS. It makes use of the P5.Play-Library. The P5.Play-Library opens up some cool possibilities, because it gives us an easy way to use the Planck Physics Engine! This is the Physics Engine used by other popular games, like Angry Birds!

Initialization

  • Generate the Background out of 3 different Forest-Tiles
  • Generate the Ground out of Earth-Tiles
  • Generate Moss out of 2 different Moss-Tiles
  • Generate Plants
  • Generate the Squirrel
  • Generate Birds 🐦 out of 3 different Bird-Sprites

🐿️The Squirrel🐿️

  • When there are no Acorns, the Squirrel idles
  • After some time, the regular Idle-Animation switches to a second Idle-Animation for a short while, and the Squirrel starts looking around
  • If a Acorn drops from a Tree 🌳, the Squirrel will jump up!
  • When the Acorn lies still, the Squirrel will run to it
  • At the Acorn, there's an 80% Chance the Squirrel will eat it, and a 20 % Chance the Squirrel will bury it

🌰The Acorn🌰

  • Yes, that Emoji is not an Acorn 🙄
  • The Acorn is where the Planck Physics Engine comes into play!
  • When generating the Acorn, several things happen:
  • A random Sprite is picked, out of 3 different Acorn-Sprites
  • A random Speed is given to the Acorn. It doesn't just drop on the floor in a straight line, it has a direction when it falls
  • The Acorn will collide with the floor, and bounce off of it
  • On the Ground, the Acorn will roll around a bit
  • All these things are made possible by using the Planck Physics Engine which is used by P5.Play-Library

🌳The Forest🌳

  • The Forest consists of 3 different Tiles:
  • Two repeating Background-Tiles (Back & Far)
  • The third Tile (Middle) can be repeated, but we pick a random distance between them, to make the Forest look more natural
  • Since we have 3 layered Background-Tiles, we use them to create a Parallax-Effect
  • This Parallax-Effect creates an Illusion of depth, making the Forest look a bit "3D"

🪴Decorations🪴

  • There are 2 different Moss-Sprites and 1 Plant-Sprite
  • We just scatter them around randomly on the Ground for some Eye-Candy

🐦Birds🐦

  • Finally, there are 3 kinds of Birds 🐦 flying around
  • These birds get generated on-the-fly
  • Each time a Bird gets generated, a random Sprite gets picked out of a pool of 3 Sprites
  • When a Bird is too far from the Squirrel 🐿️ (which is what the Camera is centered on) it gets removed and a new Bird gets generated

Related Projects

I also coded a Chicken Coop 🐔 using pure P5JS goodness.

ChickensAndBees

squirrel's People

Contributors

johnnyawesome avatar

Stargazers

 avatar  avatar

Watchers

 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.