Add new certificates for brain and brainw
- Added brain.crt containing a new certificate. - Added brainw.crt containing a new certificate.
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
import random
|
||||
import math
|
||||
from Entities.entity import Entity
|
||||
|
||||
class Marine(Entity):
|
||||
|
||||
target_cell = (8,7)
|
||||
|
||||
movement = 0
|
||||
view = 3
|
||||
|
||||
|
||||
def update(self):
|
||||
self.centered_position = (self.iso_x, self.iso_y)
|
||||
self.cast_rays_to_distance(6)
|
||||
|
||||
self.move()
|
||||
super().update()
|
||||
|
||||
@@ -109,4 +113,25 @@ class Marine(Entity):
|
||||
self.target_cell = target_cell
|
||||
if not self.engine.cmd_sound_effects:
|
||||
self.graphics.play_sound(f"marine/tmayes0{random.randint(0, 3)}.wav")
|
||||
self.engine.cmd_sound_effects = True
|
||||
self.engine.cmd_sound_effects = True
|
||||
|
||||
def cast_rays_to_distance(self, distance):
|
||||
# Cast rays to check for visibility
|
||||
done_cells = {}
|
||||
for angle in range(0, 360, 20):
|
||||
for i in range(distance, 0, -1):
|
||||
ray_x = int(self.centered_position[0] + (distance -i) * int(self.engine.graphics.cell_size/3) * math.sin(math.radians(angle)))
|
||||
ray_y = int(self.centered_position[1] - (distance - i)* int(self.engine.graphics.cell_size/6) * math.cos(math.radians(angle)))
|
||||
|
||||
v_x, v_y = self.graphics.inv_iso_transform(ray_x, ray_y)
|
||||
if v_x>= 0 and v_x < len(self.engine.map[0]) and v_y >= 0 and v_y < len(self.engine.map):
|
||||
if (v_x, v_y) not in done_cells.keys():
|
||||
done_cells.update({(v_x, v_y): self.engine.map_shadow[v_y][v_x]})
|
||||
self.engine.map[v_y][v_x]["visited"] = True
|
||||
self.engine.map_shadow[v_y][v_x] = 0
|
||||
if i == 1:
|
||||
|
||||
self.engine.map_shadow[v_y][v_x] = max(done_cells.get((v_x, v_y), 0)-0.5, 0)
|
||||
print(done_cells.get((v_x, v_y), 0))
|
||||
#self.graphics.draw_line((self.centered_position[0], self.centered_position[1], ray_x, ray_y), color=(0, 255, 0, 255))
|
||||
continue
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ class Entity:
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.next_cell = (x, y)
|
||||
self.target_cell = (x, y)
|
||||
self.iso_x, self.iso_y = self.graphics.iso_transform(self.x, self.y)
|
||||
self.action = action
|
||||
self.direction = direction
|
||||
@@ -26,7 +27,7 @@ class Entity:
|
||||
# Draw target indicator if target is set
|
||||
|
||||
|
||||
occlusion = self.graphics.map_shadow[self.y][self.x]
|
||||
occlusion = self.graphics.engine.map_shadow[self.y][self.x]
|
||||
if occlusion >= 0.8:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user