Giter VIP home page Giter VIP logo

getaway's Introduction

Get Away

Overview

Get Away Live

Get Away is a top-down scrolling car game full of obstacles. Collect as much money as you can, while avoiding obstacles. Be careful! By hitting three obstacles the police will catch up to you in no time.

Technologies Used

  • JavaScript for overall structure and game logic
  • HTML5 Canvas for rendering

Features

  • Users can choose to use directional arrows or WASD keys to maneuver their car away from obstacles
  • There will be money on the ground for users to increase their score
  • Obstacles load randomly on the road, increasing difficulty
  • Player's have three lives before the cops catch up to them, user's can collect more lives by collecting turbos

Snapshot

Highlights

Collision Detection

collide(obj1, obj2) {
if (obj1.physics.x < obj2.physics.x + obj2.sprite.width
  && obj1.physics.x + obj1.sprite.width > obj2.physics.x
  && obj1.physics.y < obj2.physics.y + obj2.sprite.height
  && obj1.physics.y + obj1.sprite.height > obj2.physics.y
) return true;

return false;
}

Infinite road rendering

if (asset instanceof Road && asset.physics.y >= 0) {
  if (sprite.height > canvas.height) {
    if (asset.physics.y > (canvas.height)) {
      asset.physics.y = canvas.height - sprite.height;
    }

    this.ctx.drawImage(sprite.img, 0, 0, sprite.width, sprite.height, asset.physics.x, asset.physics.y - sprite.height + 1, sprite.width, sprite.height);
  }
}

getaway's People

Contributors

le-s avatar tkbala avatar yashpant avatar erinkraemer avatar

Stargazers

Marcell Vazquez-Chanlatte avatar

Watchers

James Cloos avatar

Forkers

zamfi erinkraemer

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.