-
Notifications
You must be signed in to change notification settings - Fork 0
/
FakeDoors.py
51 lines (41 loc) · 1.64 KB
/
FakeDoors.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
50
import pygame
import random
class FakeDoors(object):
def __init__(self,spawnchunkx,spawnchunky,posx,posy,zielchunkx,zielchunky,zielposx,zielposy):
self.spawnchunkx = spawnchunkx
self.spawnchunky = spawnchunky
self.spawnposx = posx
self.spawnposy = posy
self.posx = -9000
self.posy = -9000
self.zielchunkx = zielchunkx
self.zielchunky = zielchunky
self.zielposx = zielposx
self.zielposy = zielposy
self.image = pygame.image.load("Assets/Durchsichtig.png")
self.teleporting_range = 100
self.chunkx = 0
self.chunky = 0
def check_teleport(self,playerposx,playerposy,chunkx,chunky,screen):
self.chunkx = chunkx
self.chunky = chunky
self.playerposx = playerposx
self.playerposy = playerposy
if self.spawnchunkx == chunkx and self.spawnchunky == chunky:
self.posx = self.spawnposx
self.posy = self.spawnposy
else:
self.posx = -9000
self.posy = -9000
screen.blit(self.image,(self.posx,self.posy))
Abstand_x = abs(self.posx - playerposx)
Abstand_y = abs(self.posy - playerposy)
#print("Abstand X: "+str(Abstand_x))
#print("Abstand Y: "+str(Abstand_y))
if Abstand_x <= self.teleporting_range and Abstand_y <= self.teleporting_range:
self.chunkx = self.zielchunkx
self.chunky = self.zielchunky
self.playerposx = self.zielposx
self.playerposy = self.zielposy
print("Player teleportiert")
return(self.chunkx,self.chunky,self.playerposx,self.playerposy)