else
This commit is contained in:
parent
192f27ff30
commit
bd9f1e5779
2 changed files with 15 additions and 12 deletions
|
@ -3,3 +3,5 @@
|
|||
\+ Added changelog. I probably will get lazy and stop updating this eventually
|
||||
|
||||
\+ Added phantom, incomplete implementation
|
||||
|
||||
\= Mouse control is a little bit nicer, click must be a minimum distance from H to initiate a move
|
|
@ -207,8 +207,8 @@ class tgame:
|
|||
|
||||
|
||||
def translatemouse(event):
|
||||
event.x -= 6
|
||||
event.y -= 14
|
||||
event.x -= 9
|
||||
event.y -= 9
|
||||
#485
|
||||
|
||||
event.x /= 8
|
||||
|
@ -216,14 +216,15 @@ class tgame:
|
|||
#print(event.x, event.y)
|
||||
xdif = event.x - self.xpos
|
||||
ydif = event.y - self.ypos
|
||||
if abs(xdif) >= abs(ydif):
|
||||
xdif /= abs(xdif)
|
||||
xdif = int(xdif)
|
||||
mfresh(xmove= xdif)
|
||||
else:
|
||||
ydif /= abs(ydif)
|
||||
ydif = int(ydif)
|
||||
mfresh(ymove= ydif)
|
||||
if abs(xdif) >= 0.5 or abs(ydif) >= 0.5:
|
||||
if abs(xdif) >= abs(ydif):
|
||||
xdif /= abs(xdif)
|
||||
xdif = int(xdif)
|
||||
mfresh(xmove= xdif)
|
||||
else:
|
||||
ydif /= abs(ydif)
|
||||
ydif = int(ydif)
|
||||
mfresh(ymove= ydif)
|
||||
tkvar.bind('<Button-1>', translatemouse)
|
||||
tkvar.bind('<Button-2>', lambda data=self.data: restart())
|
||||
tkvar.bind('<Button-3>', lambda data=self.data: spawnbomb())
|
||||
|
|
Loading…
Reference in a new issue