Giter Site home page Giter Site logo

okcraft's Introduction

OkCraft

Simple game created at the Processing Code Jam organized by the Open Tech School in Berlin

Saturday 23rd, February 2013.

By Kay and aBe

Event meetup URL: http://www.meetup.com/opentechschool-berlin/events/105194682/

Of the three proposed topics, this game deals with two: "I don't read, I just click Ok" and "Typo".

The background animated text shown during the game is the Google Search Terms of Service. The sentences you must agree with to continue alive in the game are remixed from the Facebook Legal Terms.

The game won't win too many prizes, but the structure can be useful for building other games or story telling Processing programs in which there are different states (for example intro screen, instructions, game, end screen), each state having a different fixed duration or user controlled behavior.

Extends and implements

The code makes use of "extends" and "implements" to allow storing objects of different types in one variable, and be able to call state.draw(), state.mousePressed(), state.keyPressed() and state.done(), even if we don't know if state refers to StateWait, StateIntro, StateGame or StateEnd (see that in CodeJam.pde). This is not-so-basic object oriented programming.

To give a simple example of this concept, imagine we have an array of animals. The animals could be cats, dogs or ants. Cat, Dog and Ant are three classes. But if you declare an array of Cat, you can not store Dog in that array! So the trick is to tell processing that Cat, Dog, and Ant implement Animal, which is an "interface". Then, your array will not be an array of Dog or an array of Cat, but an array of Animal instead. This allows to have mixed animals in the array. With one caveat: the animals must implement the same methods specified in the interface, for example eat(), move(), or draw().

(end)

okcraft's People

Contributors

hamoid avatar kadrian avatar

Watchers

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