Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrick95 committed Sep 5, 2016
1 parent d09e91a commit 9a0b7e9
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 30 deletions.
3 changes: 1 addition & 2 deletions Arena.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from Grid import Grid
import random
from Grid import Grid

class Arena:

Expand All @@ -24,7 +24,6 @@ def __init__(self, game_engine, width=1002, height=1002):
self.__pill_spawn_chance = self.__power_up_spawn_chance + 0.60
self.__init_pup_chance = 0.001
self.generate()
#print("done")
# self.__emptied_grids = {}


Expand Down
9 changes: 0 additions & 9 deletions Example.py

This file was deleted.

17 changes: 1 addition & 16 deletions GameEngine.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from Arena import Arena
from Player import Player
from Ghost import Ghost
from threading import Timer
import random

class GameEngine:
def __init__(self, arena_width=501, arena_height=501, max_num_ghost=35000):
Expand All @@ -15,26 +13,19 @@ def __init__(self, arena_width=501, arena_height=501, max_num_ghost=35000):
self.ghosts = {}

self.__sec_per_tick = .5
# self.__timer = Timer(self.__sec_per_tick, self.update)

def update(self):
# self.__timer = Timer(self.__sec_per_tick, self.update)
# self.__timer.start()

for player in self.players.values():
# print("Gede")
player.early_update()

for ghost in self.ghosts.values():
# print("Bagus")
ghost.early_update()

for player in self.players.values():
# print("Bayu")
player.update()

for ghost in self.ghosts.values():
# print("Pentium")
ghost.update()

players_to_delete = []
Expand All @@ -48,19 +39,13 @@ def update(self):
ghosts_to_delete = []
for ghost in self.ghosts.values():
if ghost.is_dead:
ghost_to_delete.append(ghost.id)
ghosts_to_delete.append(ghost.id)

for gid in ghosts_to_delete:
self.delete_ghost(gid)

self.arena.late_update()

# def start(self):
# self.__timer.start()

# def stop(self):
# self.__timer.cancel()

def get_arena(self):
return self.arena

Expand Down
2 changes: 0 additions & 2 deletions Ghost.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ def update(self):
self.is_dead = True
else:
if obj.has_moved:
# print('Player %d killed!' % obj.id)
obj.is_dead = True
elif obj_new_x == next_x and obj_new_y == next_y or obj_new_x == self.x and obj_new_y == self.y:
# print('Player %d killed!' % obj.id)
obj.is_dead = True

arena.move(self, next_x, next_y)
Expand Down
1 change: 0 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ def update_client():
GE = GameEngine()

ghost_counter = 1
#print("in")
for i in range(0, 500, 20):
for j in range(0, 500, 30):
for k in range(2):
Expand Down

0 comments on commit 9a0b7e9

Please sign in to comment.