FINAL BOSS
  • Hi there!
    First  congratulations for gameQuery! i just started to mess arround and it´s great!.
    I´m making some modificiations to the game (tutorial 1) and I created a new type of boss, something like the FINAL BOSS...
    It has a lot of shield and it moves faster than the others.
    What i want to do is that when the user kills the final boss the game must end.
    For this i just stoped the callback (retuning true to the callback) . 
    By doing this the creation of enemies has stopped, but now y want to give the message "YOU WIN" after the user kills the last enemy.

    Any clue for doing this?
    Thanks in advance!


  • Hi,

    A way to do this is to use the same mechanism I used to display the 'game over' message:(tutorial.js:282)

    if($("#player")[0].player.respawn()){
    gameOver = true;
    $("#playground").append('<div style="position: absolute; top: 50px; width: 700px; color: white; font-family: verdana, sans-serif;"><center><h1>Game Over</h1><br><a style="cursor: pointer;" id="restartbutton">Click here to restart the game!</a></center></div>');
    $("#restartbutton").click(restartgame);
    $("#actors,#playerMissileLayer,#enemiesMissileLayer").fadeTo(1000,0);
    $("#background").fadeTo(5000,0);
    }

    Just create a new div (or make it visible if it already exists) that cover the content of the playground and display the message you want the user to see.
  • Thanks!
  • what does this part mean, specially the [0] player respawn()?  wouldn't it be better to detect if the final boss was defeated?
    if($("#player")[0].player.respawn()){

    and would this still be reliable in 0.7 of gameQuery?

    Thanks!
  • All of the parts of this code are not dependent on gameQuery. $("#player")[0] allow you to access the DOM element (and not the jQuery object) with the id player. Then we access the player object and call its respawn methode, what this methode does is to respawn the player if possible or return true if the player is dead and has no more life.

    In this game defeating the final boss doesn't end the game, so detecting this won't be any help.

    Since this hasn't anything to do with gameQuery it would be still available on gQ 0.7.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!