parent
commit
38ecbad82e
4 changed files with 16 additions and 3 deletions
  1. +1
    -0
      main.py
  2. +12
    -0
      py/desktop.py
  3. +2
    -3
      py/desktop_Window.py
  4. +1
    -0
      py/ht_Context.py

+ 1
- 0
main.py View File

@@ -47,6 +47,7 @@ def process(c):
desktop_createConfigPlayerSprites(p) desktop_createConfigPlayerSprites(p)
desktop_createConfigStaticSprites(p) desktop_createConfigStaticSprites(p)
desktop_loadConfigTextures(p) desktop_loadConfigTextures(p)
desktop_movePlayerInstantly(p)
ctrl.registerCallback(process) ctrl.registerCallback(process)


ctrl.set("cfgPath", CFG) ctrl.set("cfgPath", CFG)


+ 12
- 0
py/desktop.py View File

@@ -78,3 +78,15 @@ def desktop_loadConfigTextures(p):
p.textures[name] = tex p.textures[name] = tex
# Report finish. # Report finish.
p.ctrl.set("didLoadConfigTextures", True) p.ctrl.set("didLoadConfigTextures", True)

# Move player instantly along X axis
#
# Conditions:
# 1. Mouse has just been clicked
def desktop_movePlayerInstantly(p):
if (
p.c.recentField != "didClickMouse"
):
return

p.player.left = p.c.didClickMouse[0]

+ 2
- 3
py/desktop_Window.py View File

@@ -17,8 +17,7 @@ class desktop_Window(arcade.Window):
self.p.playerSprites.draw() self.p.playerSprites.draw()


def on_mouse_press(self, x, y, button, key_modifiers): def on_mouse_press(self, x, y, button, key_modifiers):
print("mouse press:", x, y)
pass
self.p.ctrl.set("didClickMouse", [x, y])


def on_update(self, delta): def on_update(self, delta):
pass
self.p.playerSprites.update_animation()

+ 1
- 0
py/ht_Context.py View File

@@ -4,6 +4,7 @@ class ht_Context:
self.cfgDir = None self.cfgDir = None
self.cfgPath = None self.cfgPath = None
self.cfgTree = {} self.cfgTree = {}
self.didClickMouse = []
self.didCreateConfigPlayerSprites = False self.didCreateConfigPlayerSprites = False
self.didCreateConfigStaticSprites = False self.didCreateConfigStaticSprites = False
self.didLaunch = False self.didLaunch = False


Loading…
Cancel
Save