Developing TicToe HTML5/Implementing Client Entities: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Hendrik Brummermann |
imported>Hendrik Brummermann |
||
| Line 72: | Line 72: | ||
== Testing and Debugging == |
== Testing and Debugging == |
||
Okay, now it is time to test our code. The easiest way is, to use the Firefox extension [https://getfirebug.com/ Firebug]. |
|||
| ⚫ | |||
Open your HTML file in Firefox, which may seem boring on a quick glance as it is just a green page. Normally the server would tell the client to draw something. But as we have not implemented the server, yet, we can simulate it. |
|||
Press F12 to open Firebug and switch to the "Console" tab. At the bottom there is an input line. We want to create a gameboard and draw it. So type: |
|||
<source lang="javascript"> |
|||
a = marauroa.rpobjectFactory.create("gameboard"); |
|||
a.draw(); |
|||
</source> |
|||
The paramter of the create()-method is the name of the prototype, that we previously registered in marauroa.rpobjectFactory. |
|||
Now the game board is displayed in the top left corner of the browser window. We can move it around by changing properties: |
|||
<source lang="javascript"> |
|||
a.x = 100; |
|||
a.draw(); |
|||
</source> |
|||
We can even add more gameboard, which will be useful in a multi player game later: |
|||
<source lang="javascript"> |
|||
b = marauroa.rpobjectFactory.create("gameboard"); |
|||
b.y = 150; |
|||
b.draw(); |
|||
</source> |
|||
== Generalizing the drawing code == |
|||
| ⚫ | |||
== Drawing players == |
|||
{{TODO|write this sub-section}} |
|||
== Actions == |
|||
{{TODO|write this sub-section}} |
|||