File: panda.py

package info (click to toggle)
seahorse-adventures 1.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,936 kB
  • sloc: python: 8,640; makefile: 8; sh: 3
file content (43 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (5)
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
import pygame
from pygame.locals import *

import sprite
import player

def init(g,r,n,facing,*params):
    s = sprite.Sprite3(g,r,'panda-%s' % (facing),(0,0,31,45))
    s.rect.bottom = r.bottom
    s.rect.centerx = r.centerx
    s.groups.add('solid')
    s.groups.add('enemy')
    s.hit_groups.add('player')
    s.hit = hit
    g.sprites.append(s)
    s.loop = loop
    
    s.vx = 0
    s.vy = 0
    
    #s._prev = pygame.Rect(s.rect)
    s.strength = 30000
    
    s.standing = None
    return s
    
def loop(g,s):
    sprite.apply_gravity(g,s)
    sprite.apply_standing(g,s)
    
    #if s.rect.x == s._prev.x:
        #s.vx = -s.vx
    #s._prev = pygame.Rect(s.rect)
    
    s.rect.x += s.vx
    s.rect.y += sprite.myinc(g.frame,s.vy)
    
    

def hit(g,a,b):
    player.damage(g,b)
    #print 'youve been spikeys!'
    pass