-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoodblock.py
More file actions
40 lines (29 loc) · 821 Bytes
/
Copy pathfoodblock.py
File metadata and controls
40 lines (29 loc) · 821 Bytes
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
import random
import pygame
#class Foodblock defines a slimeblock object
class Foodblock():
def __init__(self, idx, ph):
x, y = idx
self.idx = idx
self.rect = pygame.Rect(x, y, 10, 10)
self.pheromone = ph
self.connected = 0
def get_rect(self):
return self.rect
def set_rect(self, rect):
self.rect = rect
def get_idx(self):
return self.idx
def set_idx(self, idx):
self.idx = idx
def move(self, idx):
self.set_idx(idx)
x, y = idx
new_rect = pygame.Rect(x, y, 10, 10)
self.set_rect(new_rect)
def get_pheromone(self):
return self.pheromone
def get_connected(self):
return self.connected
def set_connected(self, connected):
self.connected = connected