Akavall / GoGamesProject

Trying to make some simple games using golang.
1 stars 1 forks source link

Some questions about front end stuff. #30

Closed Akavall closed 9 years ago

Akavall commented 9 years ago

I am pretty sure that clicking "Take Turn" calls this function in zombie_dice.html:

function takeTurn() {
     $.post("http://localhost:8000/zombie_dice/take_turn?uuid=" + window.game_state_id + "&player=Andrew&continue=true", "", function(data, status) {
                parseTurnData(data)
            });
}

What does it do? :)

I am sure it calls

take_zombie_turn(...) in basic_server.go, but how?

I think zombie_dice.html is easier, and it is less important that I understand it well, just the big picture, but basic_server.go I have to understand well.

Akavall commented 9 years ago

I think I see the answer as to how take_zombie_turn is called, this line in basic_server.go:

mux.HandleFunc("/zombie_dice/take_turn", take_zombie_dice_turn)

a-temlyakov commented 9 years ago

Yeah, that's exactly it. The zombie_dice/take_turn is the path and the stuff we pass in after the question mark is the query string:

?uuid=" + window.game_state_id + "&player=Andrew&continue=true

A lot of take_zombie_dice_turn is actually spent on parsing out and error checking the query string.. which is actually another issue we need to start to clean it all up.