HI,
I'm trying to convert a simple game written in pygame in pyglet. I almost
figure out everything, but now I'm facing this situation, I have a
background sprite like this example:
<https://lh3.googleusercontent.com/-2dm2ybJClP4/VYBzG7LGq2I/AAAAAAAAAAM/26lLN4emb50/s1600/base.png>
In my pygame code I use to write this to let it scrolls smoothly in the
background:
base_shift = self.graphic.IMAGES['base'].get_width() -
self.COMMON_CONST['screenWidth']
while True:
base_x = -((-base_x + 3) % base_shift)
self.screen.blit(self.graphic.IMAGES['base'], (base_x, y))
Basically the image is longer than the actual screen and once it passes the
delta value between image X and screen X, the image is set to 0 again.
I'm trying to do the same in pyglet inside the *def update(self, dt):*
function but I have no idea exactly how to do it.
I mean I understand the meaning of dt but still I can't get it.
To move the image now I do something like this:
def update(self, dt):
self.base.x -= 30 * dt
Of course this will continue to move and it does not reset his position.
How can I replicate the behavior that I have done in pygame?
I'm sorry maybe this is a stupid question, I'm a newbie trying to learn.
thanks a lot
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.