I've used a highlighted button in fact, like this:
I've defined the coordinate where I wanted to place the button (which is 14 px big)
Code: Select all
love.graphics.draw(endturnbutton, endturnx, endturny)
I've used a test for the coordinates:
Code: Select all
if x > (endturnx-7) and x < (endturnx+7) then
if y > (endturny-7) and y < (endturny+7) then
endturnbutton = love.graphics.newImage("endturn2.png")
else
endturnbutton = love.graphics.newImage("endturn.png")
end
else
endturnbutton = love.graphics.newImage("endturn.png")
end
and elsewhere:
Code: Select all
function mousepressed(x, y, button)
if x > (endturnx-7) and x < (endturnx+7) and button == love.mouse_left then
if y > (endturny-7) and y < (endturny+7) then
tour_de_jeu() -- change the turn of play
return
end
end
end
It's working well like this. I've uploaded the new version.
What is working now:
- the turn system: after a few moves, the player can shift turn.
- moves : If the player is moving the "soldat" (black only at the moment), it will prevent to move more than 3 steps
known bug:
- it's possible to snap a pawn outside the board by mistake
Problem:
- In the rules, the "soldat" movement is:
Soldats can move 3 squares in any direction (colums, rows or diagonales). The only exception is for reaching a hill (= black square), which takes 2 moves instead of one, but for moving on a hill or going back to plains, it takes 1 normal move.
I really don't know how to implement this. The problem is
░░░░
S██E
░██░
░░░░
(S= start, E= end)
would be legal because the pawn can go round the "hill", while
░░░░
S██░
░██░
░░░E
wouldn't, because the hill should be crossed somewhere.
I'm still thinking about the problem.