Git Product home page Git Product logo

devgame's Introduction

Frontend vs backend

Description

Inspired by the competition between backends and frontends, this is a classic 2d platformer, where agility and reflexes are required to eliminate the enemy while dodging obstacles. The player must finish off the enemy's lives without leaving the platform, the enemy's speed increases gradually, and the platforms must be jumped over as they do not allow the player to pass. Collisions with the enemy and platforms subtract one life, in case of falling off the platform, it automatically loses.

MVP (DOM - LONA)

Single player game. Keyboard support.

Backlog

Refactor Welcome screen with game instructions Choice of player type Multilevel Save records. Modify platform on impact of bullets. Target for aiming when shooting Elements that add life to the player Mouse support

Data structure

const Game = {

  • canvas: undefined,
  • ctx: undefined,
  • width: undefined,
  • height: undefined,
  • FPS: 60,
  • framesCounter: 0,
  • background: undefined,
  • player: undefined,
  • enemy: undefined,
  • platform: undefined,
  • obstacles: [],
  • score: 0,
  • backAudio: new Audio("./img/music/sountrack.mp3"),
  • gameoverAudio: new Audio("./img/music/gameover.mp3"),
  • winAudio: new Audio("./img/music/win.mp3"),
  • hitAudio: new Audio("./img/music/choque.mp3"),
  • hitEnemyAudio: new Audio("./img/music/choque2.mp3"),- 1.

keys: { },

init ( ) { },

setContext ( ) { },

setDimensions ( ) { },

start ( ) { },

reset ( ) { },

drawAll ( ) { },

clear ( ) { },

isCollision ( ) { },

clearBullets ( ) { },

generateObstacles ( ) { },

clearObstacles ( ) { },

gameOver ( ) { },

win ( ) { },

sumScore ( ) { },

printScore ( ) { },

isCollisionObstacles ( ) { }, }

background.js

class Background {

constructor( ) { this.ctx = ctx; this.width = w; this.height = h;

this.image = new Image();
this.image.src = "./img/sprites juego/background/BACKGROUND 4.png";

this.posX = 0;
this.posY = 0;

}

draw ( ) { }, },

player.js

class Player { constructor(ctx, gameW, gameH, keys) { this.ctx = ctx;

this.gameWidth = gameW;
this.gameHeight = gameH;

this.width = 120;
this.height = 130;

this.image = new Image();
this.image.src =
  "./img/sprites juego/player/player quieto derecha.izquierda.png";
this.image.frames = 8;
this.image.framesIndex = 0;

this.lives = 6;
this.livesImage = new Image();
this.livesImage.src = "./img/sprites juego/player/life.png";
this.lifePosX = this.gameWidth - 100;
this.lifePosY = 0;

this.imageGameOver = new Image();
this.imageGameOver.src = "./img/sprites juego/player/gameover.png";

this.posX = this.gameWidth - this.width * 3;
this.posY = this.gameHeight - this.height * 2.5;
this.posY0 = this.posY;
this.isMoving = false;

this.isStopped = false;
this.isLookingLeft = false;
this.isLookingRigth = false;
this.lifeTimeCount = 0;

this.keys = keys;
this.bullets = [];

this.setListeners();
this.velY = 1;
this.velX = 8;
this.gravity = 0.6;
this.shootAudio = new Audio("./img/music/fire2.mp3");

}

draw ( ) { },

setListeners ( ) { },

shoot ( ) { },

clearBullets ( ) { },

moveRigth ( ) { },

moveLeft ( ) { },

jump ( ) { },

stop ( ) { },

animate ( ) { },

move( ) { }, }

enemy.js

class Enemy { constructor(ctx, gameW, gameH) { this.ctx = ctx;

this.gameWidth = gameW;
this.gameHeight = gameH;

this.width = 130;
this.height = 130;

this.image = new Image();
this.image.src = "./img/sprites juego/enemy/andar enemy.png";
this.image.frames = 16;
this.image.framesIndex = 0;

this.imageLeft = new Image();
this.imageLeft.src = "./img/sprites juego/enemy/enemywalkderecha.png";
this.imageLeft.frames = 16;
this.imageLeft.framesIndex = 0;

this.lives = 50;

this.imagewin = new Image();
this.imagewin.src = "./img/sprites juego/background/win.png";

this.posX = this.gameWidth - this.gameWidth + this.height;
this.posY = this.gameHeight - this.height * 2.5;
this.posY0 = this.posY;
this.posX0 = this.posX;
this.isMovingRight = true;
this.isMovingLeft = false;
this.isDead = false;

this.velX = 2;
this.aceleration = 0.002;

}

draw ( ) { },

animate ( ) { },

move ( ) { }, }

platform.js

class Platform { constructor(ctx) { this.ctx = ctx; this.width = window.innerWidth / 1.1; this.height = window.innerHeight / 9; this.posX = window.innerWidth / 2 - this.width / 2; this.posY = window.innerHeight / 1.4;

this.image = new Image();
this.image.src = "./img/sprites juego/Platform/платформа-png-5.png";

}

draw() { this.ctx.drawImage( this.image, this.posX, this.posY, this.width, this.height ); } }

draw ( ) { },

bullets.js

class Bullets { constructor( ctx, playerPosX, playerPosY, playerPosY0, playerWidth, playerHeight, isMovingLeft, isMovingRight ) { this.ctx = ctx;

this.posX = playerPosX;
this.posY = playerPosY + playerHeight * 0.5;

this.playerPosY0 = playerPosY0;
this.playerHeight = playerHeight;

this.radius = 10;

this.velX = 8;
this.velY = 4;

this.gravity = 0.02;
this.width = 50;
this.height = 50;

this.isMovingRight = isMovingRight;
this.isMovingLeft = isMovingLeft;

this.image = new Image();
this.image.src = "./img/sprites juego/fire.png";
this.image.frames = 6;
this.image.framesIndex = 0;

}

draw ( ) { },

move ( ) { },

animate ( ) { },

isCollisionBullets ( ) { }, }

obstacle.js

class Obstacle {

constructor(ctx, gameWidth, playerPosY0, playerHeight) { this.ctx = ctx; this.width = 100; this.height = this.width * 1;

this.posX = gameWidth - this.width - this.width;
this.posY = playerPosY0 + playerHeight - this.height;

this.velX = 1;
this.image = new Image();
this.image.src = "./img/sprites juego/obstaculos.png";
this.image.frames = 4;
this.image.framesIndex = 0;

} draw ( ) { },

move ( ) { },

animate ( ) { }, }

Trello [http://https://trello.com/b/yBrR0Su6/devgame]

Git Link Repo [http://https://github.com/Game-proyect-1/DevGame.git] link Deploy (falta el link)

Diapositivas Falta el link

devgame's People

Contributors

irenevalor avatar gitjonc 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.