-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitems.py
136 lines (111 loc) · 4.06 KB
/
items.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import pygame
from pygame.locals import *
import math
import random
import magic
class All():
DebugBool = False
DebugV = [0,0]
isHold = False
isOccupied = False
processable = True
def Draw(self):
playerrot = pygame.transform.rotate(self.image ,self.rot)
playerpos1 = (self.pos[0]-32, self.pos[1]-32)
magic.mapScreen.blit(playerrot, playerpos1)
# pygame.draw.rect(magic.mapScreen, (50,50,131), pygame.Rect((x,y),(64,64)))
def checkCollision(self, pos):
boxrect = pygame.Rect((pos[0],pos[1]),(20,20))
myRect = pygame.Rect((self.pos[0]-16,self.pos[1]-16),(34,34))
# self.DebugV = myRect
# self.DebugBool = True
boxrect.topleft = [pos[0],pos[1]]
if myRect.colliderect(boxrect):
return True
else:
return False
def Debug(self):
if self.DebugBool:
pygame.draw.rect(magic.mapScreen, (50,250,131), self.DebugV)
# self.DebugV[0] = self.pos[0]-8
# self.DebugV[1] = self.y-8
# self.DebugBool = True
def setPos(self, pos):
self.pos = [pos[0]+8,pos[1]+8]
class Onion(All):
tag = "onion"
def __init__(self, x, y):
self.skin = "resources/images/onion.png"
self.image = pygame.image.load(self.skin)
# w,h = self.image.get_size()
# self.image = pygame.transform.scale(self.image, (int(w),int(h)))
self.rect = self.image.get_rect()
self.rect.topleft = [x,y]
self.pos = [x+32,y+32]
self.rot = 0 #random.randint(0, 360)*1
def Update(self):
All.Draw(self)
All.Debug(self)
def changeSkin(self):
if self.skin is not "resource/image/onionS.png":
self.skin = "resources/images/onionS.png"
self.image = pygame.image.load(self.skin)
class Tomato(All):
tag = "tomato"
def __init__(self, x, y):
self.skin = "resources/images/tomato.png"
self.image = pygame.image.load(self.skin)
# w,h = self.image.get_size()
# self.image = pygame.transform.scale(self.image, (int(w),int(h)))
self.rect = self.image.get_rect()
self.rect.topleft = [x,y]
self.pos = [x+32,y+32]
self.rot = 0 #random.randint(0, 360)*1
def Update(self):
All.Draw(self)
All.Debug(self)
def changeSkin(self):
if self.skin is not "resource/image/tomatoS.png":
self.skin = "resources/images/tomatoS.png"
self.image = pygame.image.load(self.skin)
class Lettuce(All):
tag = "lettuce"
def __init__(self, x, y):
self.skin = "resources/images/lettuce.png"
self.image = pygame.image.load(self.skin)
# w,h = self.image.get_size()
# self.image = pygame.transform.scale(self.image, (int(w),int(h)))
self.rect = self.image.get_rect()
self.rect.topleft = [x,y]
self.pos = [x+32,y+32]
self.rot = 0 #random.randint(0, 360)*1
def Update(self):
All.Draw(self)
All.Debug(self)
def changeSkin(self):
if self.skin is not "resource/image/lettuceS.png":
self.skin = "resources/images/lettuceS.png"
self.image = pygame.image.load(self.skin)
class Plate(All):
processable = False
# TODO make states for different Foods
def __init__(self, x, y):
self.skin = "resources/images/plate.png"
self.image = pygame.image.load(self.skin)
self.rect = self.image.get_rect()
self.rect.topleft = [x,y]
self.pos = [x+32,y+32]
self.rot = 0
def Update(self):
All.Draw(self)
All.Debug(self)
# TODO Plate states
# If an item sits ontop of the Plate
# Loop through Combinations out of all incedience onto the plate plus the new one
# Take the first one all incredience work on
# Consume the item (delete it)
# Change Skin
# TODO Make a map out of all recipies (maybe in another File)
# Which items are needet?
# Can it be processed by something?
# Which state is the plate in? Choose Skin for swap and return it