Python Forum

Full Version: How to make an image move in relation to another in PYGAME
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to make a boat in pygame. I have two image: a boat and a tiller. The tiller can rotate around an axis at the back of the boat using the button left and right and the boat can move around the screen and rotate. My problem is that the two are separate(i load one image and then the other). Is it possible to make an object(oop) of a boat that when I call and rotate the two image act as one? If so how?
Set the tiller offset to a fixed point off the boat. Then move the boat around. This can be done by creating a boat class. Which will make it a lot easier to pass data back and forth.

Psuedocode...
boat_rect = boatimage.get_rect()
Tillerrect = boat_rect.center() #modify center to specific locations
Move boat_rect coordinates and the tiller will move too