script.js
// increment the player def/attack
increment the player def/attack
increment the player def / attack
function addPower(){
        var attack_index = $("#attack_index");
        var defence_index = $("#defence_index");
        player_attack_power  = 10 + current_level;
        player_defence_current = 10 + current_level;
        attack_index.text(player_attack_power);
        defence_index.text(player_defence_current + "(passive)");
        attack_index.animate({
                fontSize: '3em',
                display: 'inline',
                backgroundColor: "#FF0003"}, "fast",
            function () {
                defence_index.animate({
                    fontSize: '3em',
                        display: 'inline',
                    backgroundColor: "#FF0003"}, "fast",
                    function () {
                        attack_index.animate({
                            fontSize: '1rem',
                            display: 'block',
                            backgroundColor: "transparent"}, "slow",
                            function () {
                                defence_index.animate({
                                    fontSize: '1rem',
                                    display: 'block',
                                    backgroundColor: "transparent"}, "slow");
                            });
                    });
            });
    }
function addPower ( ) { var attack_index = $ ( "#attack_index" ) ; var defence_index = $ ( "#defence_index" ) ; player_attack_power = 10 + current_level ; player_defence_current = 10 + current_level ; attack_index . text ( player_attack_power ) ; defence_index . text ( player_defence_current + "(passive)" ) ; attack_index . animate ( { fontSize : '3em' , display : 'inline' , backgroundColor : "#FF0003" } , "fast" , function ( ) { defence_index . animate ( { fontSize : '3em' , display : 'inline' , backgroundColor : "#FF0003" } , "fast" , function ( ) { attack_index . animate ( { fontSize : '1rem' , display : 'block' , backgroundColor : "transparent" } , "slow" , function ( ) { defence_index . animate ( { fontSize : '1rem' , display : 'block' , backgroundColor : "transparent" } , "slow" ) ; } ) ; } ) ; } ) ; }
increment the player def/attack
increment the player def / attack
// define the elements // increment by level // plus a constant // update the UI // animate the changes // init the animation // animate the defence // reverse the attack index // reverse the defence