This commit is contained in:
Voussoir 2014-10-12 18:44:43 -07:00
parent 192f27ff30
commit bd9f1e5779
2 changed files with 15 additions and 12 deletions

View file

@ -2,4 +2,6 @@
\+ Added changelog. I probably will get lazy and stop updating this eventually \+ Added changelog. I probably will get lazy and stop updating this eventually
\+ Added phantom, incomplete implementation \+ Added phantom, incomplete implementation
\= Mouse control is a little bit nicer, click must be a minimum distance from H to initiate a move

View file

@ -207,8 +207,8 @@ class tgame:
def translatemouse(event): def translatemouse(event):
event.x -= 6 event.x -= 9
event.y -= 14 event.y -= 9
#485 #485
event.x /= 8 event.x /= 8
@ -216,14 +216,15 @@ class tgame:
#print(event.x, event.y) #print(event.x, event.y)
xdif = event.x - self.xpos xdif = event.x - self.xpos
ydif = event.y - self.ypos ydif = event.y - self.ypos
if abs(xdif) >= abs(ydif): if abs(xdif) >= 0.5 or abs(ydif) >= 0.5:
xdif /= abs(xdif) if abs(xdif) >= abs(ydif):
xdif = int(xdif) xdif /= abs(xdif)
mfresh(xmove= xdif) xdif = int(xdif)
else: mfresh(xmove= xdif)
ydif /= abs(ydif) else:
ydif = int(ydif) ydif /= abs(ydif)
mfresh(ymove= ydif) ydif = int(ydif)
mfresh(ymove= ydif)
tkvar.bind('<Button-1>', translatemouse) tkvar.bind('<Button-1>', translatemouse)
tkvar.bind('<Button-2>', lambda data=self.data: restart()) tkvar.bind('<Button-2>', lambda data=self.data: restart())
tkvar.bind('<Button-3>', lambda data=self.data: spawnbomb()) tkvar.bind('<Button-3>', lambda data=self.data: spawnbomb())
@ -380,7 +381,7 @@ class enemy:
self.movementy = 1 self.movementy = 1
if self.movementy < -1: if self.movementy < -1:
self.movementy = -1 self.movementy = -1
if not hasmoved: if not hasmoved:
self.x += self.movementx self.x += self.movementx
if not hasmoved: if not hasmoved: