forked from Chukobyte/seika-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added stuff for player state and updated instructions in fighter README.
- Loading branch information
Showing
11 changed files
with
85 additions
and
9 deletions.
There are no files selected for viewing
Empty file.
Empty file.
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
Empty file.
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
Empty file.
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
Empty file.
14 changes: 14 additions & 0 deletions
14
assets/game_projects/fighter/src/state/figher_game_state.py
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,14 @@ | ||
from roll.node import Node | ||
|
||
from assets.game_projects.fighter.src.input_buffer import InputBuffer | ||
|
||
class FighterUIState: | ||
def __init__(self): | ||
self.text_label = None | ||
|
||
|
||
class FighterGameState: | ||
def __init__(self, node: Node, input_buffer: InputBuffer, fighter_ui_state: FighterUIState): | ||
self.node = node | ||
self.input_buffer = input_buffer | ||
self.fighter_ui_state = fighter_ui_state |
46 changes: 46 additions & 0 deletions
46
assets/game_projects/fighter/src/state/fighter_frame_state.py
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,46 @@ | ||
import json | ||
|
||
from roll.math import Vector2 | ||
|
||
# Roughing out player state data | ||
|
||
# These will be stored by frame | ||
class AnimationState: | ||
def __init__(self): | ||
self.animation_name = "idle" | ||
self.frame = 0 | ||
|
||
@property | ||
def data(self) -> dict: | ||
return {"animation_name": self.animation_name, "frame": self.frame} | ||
|
||
def __str__(self): | ||
return json.dumps(self.data) | ||
|
||
def __repr__(self): | ||
return json.dumps(self.data) | ||
|
||
|
||
class FighterFrameState: | ||
def __init__(self): | ||
self.player = 1 | ||
self.position = Vector2(0.0, 0.0) | ||
self.inputs = ["l", "wp"] | ||
self.animation = AnimationState() | ||
self.state = "idle" | ||
|
||
@property | ||
def data(self) -> dict: | ||
return { | ||
"player": self.player, | ||
"position": {"x": self.position.x, "y": self.position.y}, | ||
"inputs": self.inputs, | ||
"animation": self.animation.data, | ||
"state": self.state, | ||
} | ||
|
||
def __str__(self): | ||
return json.dumps(self.data, indent=4) | ||
|
||
def __repr__(self): | ||
return json.dumps(self.data, indent=4) |