Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
moving image with blit
#3
(Jul-09-2019, 04:59 PM)rwahdan Wrote:
while done == False:
    screen.fill(WHITE)
# ...snip...
    screen.blit(bg_image,[45,0])
    screen.blit(player1_img, [0, 545])
    screen.blit(player2_img, [0, 565])
# ...snip...

Every iteration, you draw the players at the same spot, right before checking for events. If you want them to move, you need to track their current location somewhere (and probably initialize that location to (0, 545)), and update it when you want them to move.
Reply


Messages In This Thread
moving image with blit - by rwahdan - Jul-09-2019, 04:59 PM
RE: moving image with blit - by metulburr - Jul-09-2019, 11:46 PM
RE: moving image with blit - by nilamo - Jul-10-2019, 06:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] pygame blit() method syafiq14 1 4,920 Oct-30-2020, 04:46 PM
Last Post: Russ_CW
  index error when using lists to blit rotated images codefun45 7 3,564 Sep-03-2020, 11:11 PM
Last Post: codefun45
  How to change the player image, when moving Piethon 2 1,943 Feb-26-2020, 07:29 AM
Last Post: Piethon
  [PyGame] I found a way to generate sprites without .blit. Is it effecient? xBlackHeartx 19 8,471 Dec-07-2019, 01:06 PM
Last Post: metulburr
  error with survace.blit joemcsk1 3 4,465 Aug-06-2018, 12:23 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020