Coder Social home page Coder Social logo

game-fight's People

Contributors

helengladun avatar

Stargazers

 avatar

Watchers

 avatar  avatar

game-fight's Issues

Check for requirements

You should use: block scoping (let) - spread / rest operator - default parameters - string interpolation - arrow functions - classes + inheritance + super, async/await, promise.

Create class “Fighter”

with such properties as name, health and power. These parameters should be set in constructor. Also, class ”Fighter” should contain such methods as “setDemage”, “hit“ and “knockout”.
Method setDamage has parameter “damage” and this method sets damage to fighter via changing health property (health = health - damage) and print value health to console.

Method “hit” has parameters “enemy“, “point” and call the method of the “enemy.setDamage(damage)”. "damage” calculates as point * power, where point is a parameter from function “fight” and power is a property of the fighter who makes damage.

Method “knockout” returns promise that has been resolved after half second (use setTimeout function inside promise) and prints to console the message “time is over” before promise had been resolved.

Create async function ”fight”

with such parameters as fighter, improvedFighter and points.

This function should start the game and may have different number of parameters. For example, fight (fighter, improvedFighter, 25, 13, 45), where point = [25, 13, 45]. Players hit each other one by one with method “hit” which takes a point as an argument. If one of the players has less health then 0, you print to console that user in knockout and call “knockout” method. You should wait until promise is resolved and print to console the result of the fight.

Create class ImprovedFighter

Create class ImprovedFighter that inherits methods and properties from class Fighter.

For this class, create method “doubleHit” that calls inherit “hit” method and passes there a double point.

For each class, create two instances - fighter and improvedFighter

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.