-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#267 Made position updating very nice
- Loading branch information
1 parent
0de9948
commit 75139b8
Showing
7 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import scrap_engine as se | ||
|
||
from pokete_classes import ob_maps as obmp | ||
|
||
|
||
class PCManager: | ||
def __init__(self): | ||
self.reg = {} | ||
|
||
def set(self, name, _map, x, y): | ||
if name not in self.reg: | ||
self.reg[name] = se.Object("a", "float") | ||
self.reg[name].remove() | ||
self.reg[name].add(obmp.ob_maps[_map], x, y) | ||
|
||
def remove(self, name): | ||
self.reg[name].remove() | ||
del self.reg[name] | ||
|
||
|
||
pc_manager = PCManager() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from pokete_classes.multiplayer import connector | ||
from pokete_classes.multiplayer.pc_manager import pc_manager | ||
|
||
|
||
class ResponseManager: | ||
def __call__(self): | ||
while True: | ||
if (d := connector.connector.receive_data())["Type"] == 1: | ||
b = d["Body"] | ||
pc_manager.set(b["Name"], b["Position"]["Map"], | ||
b["Position"]["X"], b["Position"]["Y"]) | ||
elif d["Type"] == 4: | ||
pass | ||
elif d["Type"] == 5: | ||
pc_manager.remove(d["Body"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters