File: camp.py

package info (click to toggle)
oneisenough 0.40-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 616 kB
  • sloc: python: 697; makefile: 7; sh: 2
file content (41 lines) | stat: -rw-r--r-- 1,005 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
import pygame
import os

from pygame.locals import *

from locals import *

from object import Object

class Camp(Object):

  def __init__(self, screen, position = None):
    image_file = 'camp.png'
    self.otype = OBJECT_CAMP
    Object.__init__(self, screen, image_file, position, 0, 0, 0, 13, 1)

    self.time = 0
    self.got_target = False
    self.height = 0

    return

  def render_back(self):
    scaledimage = pygame.transform.scale(self.image, (self.rect.width, int(self.height) ))
    self.rect = scaledimage.get_rect()
    self.rect.center = (self.x, self.y)
    self.screen.blit(scaledimage, self.rect)
    return

  def render(self):
    return

  def update(self, borders, collideobjects, move_modifier = 1.0):
    self.time += 1
    self.height = (100 - ((float(self.time) - 30.0)/3)**2)*0.55
    if self.height > 54.3 and not self.got_target:
      self.time -= 1
    if self.height < 0:
      self.dead = True
      self.height = 1;
    return