-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (28 loc) · 1.02 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from kivy.app import App
from kivy.clock import Clock
from kivy.config import Config
from kivy.uix.widget import Widget
from kivy.core.window import Window
from game_world import GameWorld
from game_player import Player
from game_enemies import Enemy1
Config.set('input', 'mouse', 'mouse,disable_multitouch')
class Game(Widget):
def __init__(self):
super(Game, self).__init__()
self.gameworld = GameWorld(map_file='graphics/map.png')
self.player = Player(id='player1',position=(2,2))
self.add_widget(self.gameworld)
self.gameworld.add_widget(self.player)
Clock.schedule_interval(self.update, 1.0 / 60.0)
return
def update(self, dt):
self.gameworld.update()
return
class GameApp(App):
def build(self):
game = Game()
Window.size = [800, 608]
return game
if __name__ == "__main__":
GameApp().run()