add pull value
This commit is contained in:
parent
6c495c71a5
commit
e3a432cd5a
@ -33,8 +33,10 @@ document.getElementsByClassName('play')[0].onclick = function startGame() {
|
|||||||
//*********************
|
//*********************
|
||||||
// TODO Get from server
|
// TODO Get from server
|
||||||
//*********************
|
//*********************
|
||||||
playerCoordinate = [0,0];
|
getInitial()
|
||||||
playerTeam = "blue";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO IP Handling, most likely not necessary
|
// TODO IP Handling, most likely not necessary
|
||||||
|
|
||||||
@ -50,6 +52,26 @@ document.getElementsByClassName('play')[0].onclick = function startGame() {
|
|||||||
document.onkeydown = movePlayer;
|
document.onkeydown = movePlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setInitial(initial) {
|
||||||
|
playerCoordinate = initial["coordinate"];
|
||||||
|
playerTeam = initial["team"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInitial() {
|
||||||
|
$.ajax({
|
||||||
|
url: 'http://127.0.0.1:5000/game',
|
||||||
|
type: 'GET',
|
||||||
|
// data: '',
|
||||||
|
success: function(data) {
|
||||||
|
//called when successful
|
||||||
|
setInitial(data)
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
//called when there is an error
|
||||||
|
//console.log(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function serverTransfer(coordinate,team,turn,username) {
|
function serverTransfer(coordinate,team,turn,username) {
|
||||||
var move = {
|
var move = {
|
||||||
coordinate: coordinate,
|
coordinate: coordinate,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user