controller axis movement
This commit is contained in:
parent
db22a7a168
commit
3f5a10f090
1 changed files with 22 additions and 0 deletions
|
|
@ -579,6 +579,28 @@ class Creeper(Game):
|
||||||
if abs(joystick.get_axis(1)) > 0.2:
|
if abs(joystick.get_axis(1)) > 0.2:
|
||||||
self.y += joystick.get_axis(1) * 10
|
self.y += joystick.get_axis(1) * 10
|
||||||
|
|
||||||
|
if abs(joystick.get_axis(3)) > 0.2 and abs(joystick.get_axis(4)) > 0.2:
|
||||||
|
pygame.mouse.set_pos(
|
||||||
|
(
|
||||||
|
pygame.mouse.get_pos()[0] + joystick.get_axis(3) * 32,
|
||||||
|
pygame.mouse.get_pos()[1] + joystick.get_axis(4) * 32,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif abs(joystick.get_axis(3)) > 0.2:
|
||||||
|
pygame.mouse.set_pos(
|
||||||
|
(
|
||||||
|
pygame.mouse.get_pos()[0] + joystick.get_axis(3) * 32,
|
||||||
|
pygame.mouse.get_pos()[1],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif abs(joystick.get_axis(4)) > 0.2:
|
||||||
|
pygame.mouse.set_pos(
|
||||||
|
(
|
||||||
|
pygame.mouse.get_pos()[0],
|
||||||
|
pygame.mouse.get_pos()[1] + joystick.get_axis(4) * 32,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def inventory_keys(self):
|
def inventory_keys(self):
|
||||||
keys = self.keys
|
keys = self.keys
|
||||||
if not self.joysticks:
|
if not self.joysticks:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue