Wednesday, October 9, 2013

Bad Output but Output


 
    I have had some time to work on Dragon Smasher. I am now sending output dynamically to be displayed on the webpage. The output is garbage though. The function itself that handles the output is okay though.


Here is the html:


<div class='game' id='message_box'>
              <p class="game">Message Box</p>
</div>

Here is the javascript that accesses the DOM and lets us manipulate the contents of the Div:


var messageEl = document.getElementById('message_box');

Here is the function:


function sendMessage(output,addOrReplace){
    if(addOrReplace == true){
       messageEl.innerHTML = '<p class="game">' + output + '</p>';
    }
    else{
        messageEl.innerHTML += '<p class="game">' + output + '</p>';
    }
}
 I am sure there are also better ways to do this and as the project goes on a may adopt a more sophisticated method.

Also for the graphics I will be using the assets from this game: Heroine Dusk. The art assets can be found here.


No comments:

Post a Comment