Giter VIP home page Giter VIP logo

snakell-openframeworks's Introduction

of-snake

Open Frameworks Snake Implementation

NOTE: The current implementation is subopmtimal due to limitations in the linked list implementation. I strongly recommend reading through all of the documentation in the header files in addition to this README

  1. Application Loop The application is controlled by open frameworks. The main snake application extends ofBaseApp, the base open frameworks application.
  • The main event loop is composed of
    • update() Which updates the models used to represent objects of the game
    • draw() Which interprets and renders the objects on the players screen
    • keyPressed() Called when the user presses a key
    • windowResized() Called when the user resizes the window, requires the location and dimensions of objects to be correspondingly resized
  • Notes
    • All of our objects sizes are defined relative to the window width (this provides us with a simple way to adapt the size of on screen objects to the users display)
    • We use a naive algorithm to update the position of our snake on the screen. The algorithm follows:
    snakebody curr = head.next
    while curr:
       curr.position = curr.prev.position
       
    if current_direction == UP:
       head.position += (0, head.height)
    # Update head for remaining directions...
    
    • This is a simple but naive way to update the snake's position, but it has the major side effect of making the animation frame dependent (we can't split up this update process over multiple frames).

snakell-openframeworks's People

Contributors

yashosharma avatar alexmackowiak avatar gcevans avatar

Watchers

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