File: center_character.py

package info (click to toggle)
adonthell-data 0.3.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,776 kB
  • ctags: 389
  • sloc: python: 4,667; sh: 3,327; makefile: 362; sed: 16
file content (29 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (4)
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
#
#  (C) Copyright 2001 Alexandre Courbot <alexandrecourbot@linuxgames.com>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

#  Mapview schedule that makes it always center on a constructor-time
#  given mapcharacter

import adonthell

class center_character:

    # Parameters:
    # mapcharinstance: Name of the mapcharacter to follow
    def __init__ (self, mapviewinstance, mapcharname):
        self.myself = mapviewinstance
        self.tofollow = adonthell.gamedata_get_character (mapcharname)

    def run (self):
        p = self.tofollow
        self.myself.center_on(p.submap(), p.posx(), p.posy(), p.offx(), p.offy())