0

I'm building a simple game in kivy where I move a player on a map and the map moves consequently to keep the player at the center of the screen. But, the problem is that the map is composed by individual tiles with individual properties. How can I move all the elements at the same time?? I'm in trouble with that and I can't reach a solution.

This is the portion of code:

'''

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Rectangle
from kivy.uix.behaviors import DragBehavior


class MainGame(Widget):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
    
    with self.canvas:
        Rectangle(source= "stone_tile.png",pos=(220,-300), size=(1000,1000))
        Rectangle(source= "grass_tile.png", pos=(0,-400), size=(1000,1000))

class FarIslands(App):
    def build(self):
        return MainGame()


if __name__ == '__main__':
    FarIslands().run()

''' I need to move the two rectangles at the same time. In the final version there will be hundreds of elements to create a game map. Maybe, is there a better way, instead using Widget canvas? Because I need to add other functions to the tiles...

0 Answers0