Code Monkey home page Code Monkey logo

rehanumar / p3-classic-arcade-game Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 194 KB

A clone of the classic arcade game Frogger using the canvas APIs and Object Oriented JavaScript.

Home Page: https://rehanumar.github.io/p3-classic-arcade-game/index.html

License: MIT License

CSS 0.76% HTML 5.55% JavaScript 93.69%
arcade-game object-oriented-javascript html5-canvas canvas-game canvas-2d-context html5-game-development canvas-api frogger-game javascript-game

p3-classic-arcade-game's Introduction

p3-classic-arcade-game

This is a clone of the classic arcade game Frogger observing the feasibility of game engines in JavaScript! This project is using the HTML5 canvas element and JavaScript canvas APIs. The live demo of this project is available here.

Explanation of project structure:

  • index.html is pretty much empty! it only contains the canvas element and instructions to play the game
  • js/app.js contains the game characters and do the event handling
  • js/engine.js have the actual game loop which sets the canvas and redraw the game each time based on the game characters data. It is doing a little more then that so dig through the code to fully understand it.
  • js/resources.js is just a resource caching utility

How to run the application

  • clone it.
  • Open the index.html file in your browser.

p3-classic-arcade-game's People

Contributors

rehanumar avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

seanriggs

p3-classic-arcade-game's Issues

Help with creating Game Over Screen

I have forked your repo and customized it to add instructions and other simple things and have themed it. I am trying to add a game-over screen so that I can try to implement a high score screen. I cannot figure out the logic. I can get the app.js to talk to the console but I have tried for hours to add logic to do this .. for example one of the things I tried was:

function checkCollisions() {

// Check if the player's life reaches zero
if (app.ACTORS.player.life <= 0) {
// Display the game over popup
document.getElementById("game-over-popup").style.display = "block";
// Update the final score in the game over popup
document.getElementById("finalScore").textContent = app.ACTORS.player.score;
}
};

app.Player.prototype.update = function() {
if (this.life <= 0) {
// Trigger game over pop-up and send a message when the score is zero
console.log("Sending 'gameOver' message.");
showGameOverPopup(this.score);

  // Send a message to the parent window
  if (this.score === 0) {
      window.parent.postMessage("gameOver", "*");
  } else {
      console.log("Score is not zero. Message not sent.");
  }

}
};

and added a listener to the HTML ... but it wont talk! (I defined the app.Actors.Player as well).

I am stuck for now and was hoping maybe you had insight on this?

I appreciate any insight. Warm Regards

Sean

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.