forked from satanas/ngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sideview_example.py
42 lines (34 loc) · 1.31 KB
/
sideview_example.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#================================================
#
# This script shows how to use Ngine to create a simple side-view game
#
# Copyright (C) 2010-2011 Wil Alvarez <[email protected]>
#
#===================================================
import pygame
from ngine import director
from ngine import gamedata
from ngine import inputparser as input_p
from dummy_keys import *
from sideview_scene import DummyScene
def main():
gdata = gamedata.GameData('Side-View Example - Ngine', (640, 480), 60)
# Map all input keys to Input Parser
_input = input_p.InputParser()
_input.bind_key(input_p.KEY_DOWN, pygame.K_LEFT, LEFT, True)
_input.bind_key(input_p.KEY_DOWN, pygame.K_RIGHT, RIGHT, True)
_input.bind_key(input_p.KEY_DOWN, pygame.K_UP, UP, True)
_input.bind_key(input_p.KEY_DOWN, pygame.K_DOWN, DOWN, True)
_input.bind_key(input_p.KEY_DOWN, pygame.K_SPACE, ACTION1)
_input.bind_key(input_p.KEY_DOWN, pygame.K_LCTRL, ACTION2)
_input.bind_key(input_p.KEY_DOWN, pygame.K_LSHIFT, ACTION3)
_input.bind_key(input_p.KEY_DOWN, pygame.K_ESCAPE, EXIT)
_dir = director.Director(gdata)
scene = DummyScene(_dir, _input, gdata)
_dir.change_scene(scene)
_dir.loop()
if __name__ == '__main__':
pygame.init()
main()