1

I've been trying to make a game with Python Arcade Library and I got the scrolling and aiming function ready, but for some reason, while I'm scrolling, the crosshair that's following the mouse suddenly stops and it cannot go over that point. Also, the crosshair sprite isn't exactly "following" the mouse cursor. It becomes offset from the mouse after a bit.

# Manage Scrolling
    self.view_left = SCREEN_WIDTH / 2 - (self.crosshair.center_x - self.anchor.center_x) / 2
    self.view_bottom = (self.crosshair.center_y - self.anchor.center_y) / 2 - SCREEN_HEIGHT / 2

    # Do the scrolling
    arcade.set_viewport(self.view_left, self.view_left + SCREEN_WIDTH, self.view_bottom, self.view_bottom + SCREEN_HEIGHT)

I'm trying to make it so that the middle point of the viewport is on the middle point between the player sprite and the character.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
jun2040
  • 37
  • 6
  • Would it be possible to provide a [mcve]? This isn't that much to work from. Thanks. – ggorlen Jan 15 '20 at 16:24
  • https://github.com/jun2040/Python-Game The anchor is the part that actually moves. every limbs follow the anchor. – jun2040 Jan 16 '20 at 01:29
  • This should be in the question itself, but 800 LOC is too much. 95% of this has no relevance to viewporting and can be eliminated. The idea is to strip it down to the bare minimum necessary to reproduce the problem. Create a toy example (and read the above MCVE link). Thanks. – ggorlen Jan 16 '20 at 02:01

0 Answers0