-
Notifications
You must be signed in to change notification settings - Fork 0
/
bg.py
49 lines (40 loc) · 1.39 KB
/
bg.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
45
46
47
48
49
import images
#import pygame
import math
import random
import numopers as ops
_long = 13
class BackgroundAnim:
x,y = 0,0
scrollspd = 0.5
scrollang = random.randint(0,359)
scrollx = math.sin( math.radians(scrollang) )*scrollspd
scrolly = math.cos( math.radians(scrollang) )*scrollspd
ang = 0
okthanksval = 0
tile = None
def __init__(self):
self.tile = images.get("bggrid")
def okthanks(self, n):
self.okthanksval = n
self.scrollspd = self.okthanksval/12
def recalculateScroll(self):
#self.scroll
self.scrollx = math.sin( math.radians(self.scrollang) )*self.scrollspd
self.scrolly = math.cos( math.radians(self.scrollang) )*self.scrollspd
#print("ok")
def daemon(self, surface):
self.x = ops.wrap(self.x + self.scrollx, 0, 64)
self.y = ops.wrap(self.y + self.scrolly, 0, 64)
self.scrollang += 0.2
self.recalculateScroll()
#if self.x > 64: self.x -= 64
#if self.y > 64: self.y -= 64
for yt in range(0,_long):
for xt in range(0,_long):
surface.blit(self.tile, [xt*64 - self.x, yt*64 - self.y])
#t = pygame.time.get_ticks()/10
#rad = math.cos( math.radians(t) )*16
#surface.blit(pygame.transform.rotate(surface, rad), [0,0])
#surface.scroll(-64, -64)
#surface.scroll(int(self.x), int(self.y))