Python Forum
How can I make all of the background move as opposed to just one platform?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I make all of the background move as opposed to just one platform?
#6
This is the tutorial I learned it from.

https://www.youtube.com/watch?v=uWvb3QzA...WldfCLu1pq

He uses:
def update(self):
        # Game Loop - Update
        self.all_sprites.update()
        hits = pg.sprite.spritecollide(self.player, self.platforms, False)
        if hits:
            self.player.pos.y = hits[0].rect.top
            self.player.vel.y = 0
You can also use something like:
def moveLeft(self):
                        
     hits = pygame.sprite.spritecollide(self.player, self.platforms, False)
     if not hits:
         self.xVel = 6
I think that works.
Reply


Messages In This Thread
RE: How can I make all of the background move as opposed to just one platform? - by michael1789 - Dec-28-2019, 10:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Players not falling from the platform, and some other errors. urmom33 1 1,759 Jan-23-2023, 10:28 PM
Last Post: deanhystad
  How to make an image move in relation to another in PYGAME CompleteNewb 1 2,398 Nov-10-2021, 03:38 PM
Last Post: metulburr
  [PyGame] how to make objects move at a precise amount of time? Zhaleh 2 2,732 Aug-02-2020, 02:52 PM
Last Post: Zhaleh
  How to make a walljump + move between rooms ? dMn420 1 2,628 Jul-17-2019, 08:49 PM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

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